我正在尝试使用 scons 编译带有 -std=c=+11 选项的 c++ 文件。
文件:测试.cc
#include <unordered_map>
int foo()
{ return 0; }
文件:S构造
env = Environment()
env.Append(CXXFLAGS = '-std=c++11')
#print env['CXXFLAGS']
src_files = Split('test.cc')
lib_name = 'test'
Library(lib_name, src_files)
我收到以下错误。当调用 g++ 时,CXXFLAGS 似乎没有生效:
g++ -o test.o -c test.cc
In file included from /usr/include/c++/4.8.2/unordered_map:35:0,
from test.cc:2:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: 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.
#error This file requires compiler and library support for the \
^
scons: *** [test.o] Error 1
我读过一些关于通过修改“构造环境”来使用 -std=c++11 选项编译 c++ 文件的帖子,我觉得我已经做到了。有人可以帮忙吗?
谢谢你,
艾哈迈德。
Use env.Library
代替Library
使用您的构建环境构建库。
env = Environment()
env.Append(CXXFLAGS = '-std=c++11')
src_files = Split('test.cc')
lib_name = 'test'
env.Library(lib_name, src_files)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)