0
當使用G ++編譯cpp文件,我得到這樣的錯誤:我應該使用哪個選項讓g ++識別'nullptr'?
xx.cpp:25:5: error:'nullptr' was not declared in this scope.
# the error is translated by me :)
在「nullptr」只是在C++ 11加入。我猜g ++中的默認版本可能是舊版本,所以g ++無法識別'nullptr'。 (我的g ++版本是4.6.3)相反,我在.cpp文件之前添加了-std = C++ 0x,但它仍然不起作用。然後我在gcc手冊中找到了,只發現與麻煩無關。
因此,我希望這裏有人能回答我的問題,謝謝你的幫助。
http://stackoverflow.com/questions/10363646/compiling-c11-with-g – qwr
根據功能列表,GCC 4.6 .3應該支持nullptr:http://gcc.gnu.org/gcc-4.6/cxx0x_status.html 你可以發佈你的命令行和顯示這個錯誤的代碼行嗎? –