如何让scons使用带有libc++的Clang?

4
我该如何让scons使用Clang和libc++? 将"-stdlib=libc++"添加到我传递给环境变量的任何标志中都会导致出现未定义的引用错误,例如以下内容:
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> >&)':
1个回答

6
选择libc ++的选项需要同时在编译器和链接器标志中设置:
env = Environment(CXX = 'clang++',
                  CXXFLAGS = '-std=c++11 -stdlib=libc++',
                  LINKFLAGS = '-stdlib=libc++')

env.Program('hello.cpp')

对我来说不起作用,scons仍然尝试使用Visual Studio命令进行链接步骤,此外,scons正在将“/nologo”注入CCFLAGS。 - Nick

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接