Creating a Simple C++ Application to Use C++11 Features

From Appmethod Topics
Jump to: navigation, search

Go Up to C++11


Appmethod C++ provides support for C++11, the most recent version of the C++ standard.

The simplest way to test and use the new C++11 features in Appmethod C++ applications is to create a C++ console application, as described in the following steps. Using a C++ console application gives you a simple application in which you can test the C++11 syntax without a framework attached.

Note: The same basic steps described here (creating a C++ console application) are useful for practicing any features of the C++ compiler, or for doing "bare bones" C++ development and testing, with only the RTL attached.

Steps

  1. Choose File > New > Other.
    FileNewOther.png

  2. The New Items dialog box appears. Click Appmethod C++ Projects, select Console Application, and click OK.
    C++NewCOnsoleApplication.png

  3. The New Console Application (C++) dialog box appears. Make sure that C++ is selected as source type. If you want to select a framework for your application, choose FireMonkey on the Target Framework combo box; if not, choose None. Leave the other options to default and click OK.
    NCA01.png

  4. In the Project Manager, right-click Target Platforms and select Add Platform.
    AddPlatfromRC.png

  5. In the Select Platform dialog box, select 64-bit Windows and click OK.
    SelectPlatform64.png

  6. The Code Editor appears, displaying skeleton code for a simple C++ application. You can write your C++11 code inside this file.
    For example, the following piece of code uses the auto keyword as defined in C++11:
#include <iostream>
int main() {
        char array[] = {'C', '+', '+', '1', '1'};
        for (auto&i : array) {
                printf("%c", i);
        }
        std::cin.get();
        return 0;
}
7. Press the F9 key or select Run > Run to run the application:
RunApplication.png

For C++11 code examples, see C++11.

See Also