Question

I need to use data structures like unordered_map within my code in network simulator NS-3. It is using waf builder to compile the source code. I am confused that where should I add -std=c++0x to be added to compiler flags? I tried appending it to CXXFlags in main wscript file using:

module.env.append_value('CXXFLAGS', '-std=c++0x');

But still I am getting this error:

This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options. C/C++ Problem

Should I also add any library to my waf module as well?

P.S: My GCC version is 4.4

Update: After updating to 4.7 I get this error:

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Is there a way to tell compiler to use 0x instead of 11?

Was it helpful?

Solution

Here is the solution:

First of all upgrading GCC to 4.7 for Ns-3 will cause more errors due to changes in standard and does not solve the problem. So I changed gcc and g++ back to 4.4.3.

But in order to get rid of this error (as it says) this option should be added to CXXFLAGS:

-std=c++0x

To add an option to CXXFLAG you can use this:

CXXFLAGS="-std=c++0x" ./waf configure

or if you want to add options to waf configure:

CXXFLAGS="-std=c++0x" ./waf -d debug --enable-examples --enable-tests configure
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top