如何让scons使用Clang和libc ++?把" -stdlib = libc ++"在我传递给Environment的任何标志中都会导致未定义的引用错误,如下所示:
hello.o: In function `main':
hello.cpp:(.text+0xc): undefined reference to `std::__1::cout'
hello.o: In function `std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)':
答案 0 :(得分:6)
选择libc ++的选项需要同时包含在编译器和链接器标志中:
env = Environment(CXX = 'clang++',
CXXFLAGS = '-std=c++11 -stdlib=libc++',
LINKFLAGS = '-stdlib=libc++')
env.Program('hello.cpp')