Skip to content

The 25 days of C++mas - December 14 - your first C++11 app with C++Builder XE3

As you have read on this blog, we are now shipping the C++Builder XE3 64-bit Windows compiler which includes support for the C++11 language, Dinkumware standard C and C++ libraries version 5.3  and Boost libraries version 1.50.0.  All current RAD Studio XE3 and C++Builder XE3 customers can download the update install for the new 64-bit C++11 compiler and libraries.  Non-customers can also try the new C++Builder XE3 C++11 compiler by downloading  the C++Builder XE3 trial or RAD Studio XE3 trial.  So, after you have the new compiler, how can you try the new C++11 language support?  The fastest way is to create a new C++ console application. Then you can try using our VCL and FireMonkey business application frameworks with the new C++11 language and libraries.  Let’s keep things simple and start with a C++ console application.

Building and running your first C++Builder XE3 64-bit C++11 application

In this first C++11 example, I will show you how to build a Console Application that runs from the command line on a Windows 64-bit operating system. While the C++Builder XE3 IDE is a 32-bit Windows application, it can run on the Windows 64-bit operating system. To run this first C++11 application you will need a 64-bit Windows OS. There are several steps to follow to build your first C++11 application.

Step 1) After starting the IDE, create a command-line application by choosing the project type from the gallery. You can access the gallery several ways but the easiest is to use the File menu and choose the “New | Other…” sub-menu choice.

Step 2) In the C++Builder projects list you will see several application types in the window (see picture below). Select Console Application click the OK button.

Step 3) Next, you will see the “New Console Application” wizard dialog. This allows you to choose why type of console application you want to create. You can choose the source type (C or C++), choose C++. You can also decide whether you want to use a framework in your application (none, FireMonkey or Visual Component Library). Choose None. Leave the other choices at the defaults and then click the OK button.

Step 4) Back in the IDE you will see that a project was created and is visible in the Project Manager view in the upper right hand window next to the editor window. Within the Project Manager you will see a Target Platforms node. Right mouse click on that node and select Add Platform.

Then choose 64-bit Windows from the "Select a Platform" pop-up dialog.

Step 5) In the code editor window Replace the C style main function and headers

with the following C++11 source code

    #include <iostream> 
    
    class A {
    public:
    	int a;
    };
    
    int main() {
    	auto a = 1;
    	auto b = 3.14;
    	std::cout << a << std::endl;
    	std::cout << b << std::endl;
    	std::cout << "sizeof a = " << sizeof(A::a) << std::endl;
    	std::cin.get();
    	return 0;
    }

Step 6) Build and run the application by hitting the F9 key or use the Run | Run and you will see the following output from the 64-bit C++11 console application:

That’s it!

You followed a few simple steps and you are now on the road to C++11 programming with C++Builder XE3 and the 64-bit Windows compiler. Next you can try building VCL and FireMonkey (HD and 3D) applications using C++11 and the 64-bit compiler.

Additional information can be found in the following Embarcadero DocWiki articles:

Watch/Download the C++Builder 64-bit Compiler Preview Video

Additional details about the 64-bit C++Builder compiler are available in the preview video.  Watch the C++ 64-bit compiler preview video on YouTube at http://www.youtube.com/watch?v=PwwMpBUoR6Y. You can also download the MP4 video file at http://cc.embarcadero.com/item/29197.  The preview video is 9 minutes long.

Try the C++Builder 64-bit compiler

The C++Builder XE3 and RAD Studio XE3 free trial downloads have been updated to include the new C++Builder 64-bit compiler.  Trial downloads are available at https://downloads.embarcadero.com/free/c_builder

Happy C++mas!

During the first 25 days of December leading up to Christmas, I will blog about the release of the C++Builder 64-bit compiler for Microsoft Windows and C++Builder XE3 support for building VCL and FireMonkey 2 applications.

{ 2 } Comments

  1. kobe roman | February 4, 2013 at 5:46 pm | Permalink

    RAD Studio XE3 Architect license

  2. David I. | February 4, 2013 at 5:48 pm | Permalink

    Kobe - not sure what your comment is, What about "RAD Studio XE3 Architect license"?

Post a Comment

Your email is never published nor shared. Required fields are marked *

Bad Behavior has blocked 4 access attempts in the last 7 days.

Close