系统详细信息:
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
答案1
根据您希望使用的 C++11 的部分,您需要传递一个额外的开关:
-std=c++0x
g++ 4.7 及更高版本使用:
-std=c++11 and -std=gnu++11
诸如此类的编程特定问题可能更适合 stackoverflow.com。