How to create NS-3 to use C ++ 0x / C ++ 11 libraries?

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

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

But still I get this error:

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

Should I also add any library to my waf module?

PS: My version of GCC is 4.4

Update: after upgrading 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 any way to tell the compiler to use 0x instead of 11?

+4
source share
1 answer

Here is the solution:

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

But in order to get rid of this error (as they say), this option must be added to CXXFLAGS:

 -std=c++0x 

To add a parameter to CXXFLAG, you can use this:

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

or if you want to add parameters to waf configure:

 CXXFLAGS="-std=c++0x" ./waf -d debug --enable-examples --enable-tests configure 
+8
source

All Articles