Quantcast
Channel: askyb.com » G++
Viewing all articles
Browse latest Browse all 4

Compile C++0x or C++11 in GCC

$
0
0

Compiling of C++ program with C++0x or C++11 support is simple by using of gcc compiler. C++0x or C++11 features are available in gcc compiler start from version 4.3 onward. If you are using gcc 4.3 onward, you may compile your C++ program with C++0x or C++11 support now.

Important: GCC’s support for C++11 is still experimental

Although you can compile with the new C++ standard support, not all features are available in one single gcc version. However, the greater version should have more features as compare to the old version.

Sample command to compile C++ with C++0x or C++11 support
To enable C++0x support, add the command-line parameter -std=c++0x to your g++ command line

g++ [source] -std=c++0x -o [output]

Sample:

g++ hello.cpp -std=c++0x -o Hello

The command will compile hello.cpp file with C++0x enabled and produce an executable output called “Hello”

Notes:
Command-line parameter -std=c++11 only available from gcc 4.7 onward.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images