Question

I have been using C++ Builder to develop some classes. I have been using the TDateTime data type by including the 'vcl.h'. Is this only unique to C++ Builder?

I ask this because I am now using Microsoft Visual Studio C++ and am getting a 'TDateTime is undefined error'.

How can I use this type in Visual Studio?

Thanks

Was it helpful?

Solution

Most of Borland's Visual Component Library is built around it's own compiler-specific extensions and delphi code. I very much doubt you will have an easy time getting it to work under any other compiler.

LUckily there are plenty of alternatives. If you're using Visual C++, then you can use Microsoft's Date/Time libraries: http://msdn.microsoft.com/en-us/library/6ahxxcsz%28v=vs.100%29.aspx

There are also portable libraries from Boost and QT which should run under any modern C++ compiler

OTHER TIPS

I would suggest having a look at boost.datetime and, if you have access to C++11 support, the standard C++ time and time duration utilities available in the <chrono> header. One advantage of using either of these is that they are portable, so you are not bound to a given compiler or development environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top