Reputation: 1673
When using g++ to compile the .cpp file, I got the error like this :
xx.cpp:25:5: error:'nullptr' was not declared in this scope.
# the error is translated by me :)
The 'nullptr' is added just in C++11. I guess the default version in g++ may be the old version, so g++ can not recognize 'nullptr'. (My g++ version is 4.6.3) Instead, I added -std=c++0x before the .cpp file, but it still not worked. Then I seeked in the gcc manual,only find nothing relevant to the trouble.
Therefore, I hope someone here can answer my question, thank for any help.
Upvotes: 0
Views: 349
Reputation:
If nullptr
is only recognised in C++11, why would you compile with C++0x?
Use -std=c++11 when you compile:
g++ -std=c++11 xx.cpp
Upvotes: 1