TDateTime data type - c++

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

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.

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
http://www.boost.org/doc/libs/1_51_0/doc/html/date_time.html
http://doc.qt.digia.com/4.5/qdatetime.html

Related

Unreal Engine 4.25, stdlib C++ 17/20 and Visual Studio Code status between them and/or integration?

I have seen there are several ways to add C++17.
I know that earlier ,like in 2015. we couldn't use, or we had to wrap containers from std. I am interested, is now better situation with using C++ stdlib in UE4? Is standard C++ now more (or totally) integrated with UE4 version of C++, or can be that done with some VSC(or UE4) add-on?

Does Armadillo run well with Embarcadero C++ Builder XE*?

I plan to purchase Embarcadero C++Builder XE* and later install Armadillo C++ linear algebra library , so I can work on the sparse matrix type of projects. Before I purchase C++ Builder XE* from Embarcadero, I just wonder if Armadillo works well with Embarcadero C++ Builder XE*. I think lots of you run Armadillo, do some of you run Armadillo in Embarcadero C++BuilderXE2~4? Does Armadillo run well there?
Thanks for feedback.
Eddy
Armadillo requires a C++ compiler that can properly handle template meta-programming: the compiler has to properly support the C++ standard.
Is there a particular reason you need the Embarcadero C++ Builder ?
These days we have the luxury of very high quality C++ compilers that are both free (no-cost) and open-source. You may wish to look into compilers such as GCC and Clang, which can be used in conjunction with Eclipse.
All Linux distributions come with GCC pre-compiled. You can get GCC for Windows from the MinGW project.
C++Builder's 32-bit compiler has several issues with more complicated C++ constructs, so it's not unusual for me to have to do some porting work to get C++ libraries to build in it. All other things being equal, I'd recommend another compiler.
I have no experience with Armadillo in particular, but Embarcadero has a free trial available, so you should be able to try it yourself.

How to use C++11 threading with Visual Studio

Before I start I want to explain that I am a novice and that it's highly possible that I've missed something simple or that there's something simple that I just don't know about.
Using visual studio I wanted to get a bit of threading practice in but I can't get it to include at the top of my code. I know that is new to C++11 but I'm not sure if that's enabled for Visual Studio 2010 or if it isn't I'm not sure how I would go about doing that.
Here is a screenshot of my code:
You cannot: C++11's Thread support library is not supported by the implementation of the C++ Standard Library shipped with VS2010. You should upgrade to VS2012 if you want to use it.
Alternatively, you could use Boost.Thread, which served as an inspiration for C++11's Standard Thread support library.
As a further option, you could consider purchasing the Just.Thread library, which provides a complete implementation and is available for VS2010 as well.

visual c++ and C++ builder

Can C++builder compile any c++ source files.
I don't have a good knowledge in c++. but i have some experience in delphi.
I like to use c++ but confused which one to use
I know that cbuilder has vcl , easy to develop ,easy for delphi developer
But my problem is can it compile any c++ files (vc++ and other source files).
is it compatible with vc++ (excluding MFC and VCL). Can i use any APIs with c++builder
You'll find C++ Builder very comfy coming from Delphi if you don't care about MFC or .NET via C++/CLI etc and just want native C++ then either will work for you. Visual Studio 2010 supports a lot of the new C++0x features which is pretty nice, although they don't have variadic templates yet. I'm not sure how much of C++0x is in C++ Builder as yet but that could be worth looking into as a deciding factor.
It should be able to compile any standards conforming code. If the code uses extensions that another compiler provides, it will more than likely have problems. VC++ has quite a few extensions that are on by default and so someone using that compiler might use them with out realizing what is going on(the same applies to G++ the other major C++ compiler out there.)
In my experience, C++Builder's support for more advanced C++ code is limited. For example, many of Boost's libraries are unsupported in C++Builder, and I've often had to modify other open source libraries to get them to build properly in C++Builder (due to various bugs or limitations in C++Builder's compiler). Simpler C++ code can work without any problems.
So, depending on what C++ libraries / source files / APIs you're wanting to use, getting them to work in C++Builder may be very straightforward, or it may take significant work.
You can download a free version of C++ Builder at www.embarcadero.com. With that, you can test your libraries for compatibility.

Which C++ does Visual Studio 2008 (or later) use?

I find C++ is very controversial language in microsoft world. By default we have ISO C++ and then microsoft has Managed C++ and now C++ CLI.
I just know standard (ISO) C++. I don't know microsoft's version of C++.
I'm confused about interpretation of any c++ code by visual studio 2008 (or later). Thats why I'm using gnu tools for compiling my programs. But I do love Visual Studio.
What settings do I need to make if I only want to use
STRICTLY ISO C++
Managed C++ (its deprecated but I think they still support it for sake of backward compatibility)
C++ CLI (for .NET platform)
I want to build native assemblies using C++ not managed ones. So, is there anything else should I need to do?
Everything is in the build settings:
Common Language Runtime Support (/clr) - add or remove CLR support
Advance Compile as C++ Code (/TP) - to choose if c++ or c..
Language: Disable Language Extention - use this to force ANSI.
When you ask Visual Studio to make a C++ project, it makes a C++ project. C++/CLI is a different language.
VS2008 and earlier have implemented C++03 (or approximated it. Like almost every other compiler, there are bits of the standard that are not followed to the letter. A few features are not implemented (exception specifications, the export keyword or two-phase name lookup are the ones I can think of), and some proprietary extensions are added as well.
GCC, and most big compilers, do the exact same thing, so this isn't a case of Microsoft being "evil" as such. The extensions can be disabled, leaving you with a reasonably standards-compliant compiler.
VC2010 is adding a number of C++0x features (and at least in the beta, I haven't been able to find an option to disable these), so from a strict C++03 compliance point of view, it is going to be less compliant.
Dani's answer already tells you which settings to change to enable/disable different language dialects.