让clang++使用GCC的libstdc++ (-stdlib=stdc++)是相当容易的,但我该怎么做呢?在other上,c++系统库是libc++,这意味着基本上不能使用libstdc++ (如果您与其他c++库(如使用libc++编译的boost )混合使用)。因此,粗略地说,这意味着G++是不可用的.除非我可以要求它使用libc++而不是libstdc++。
谢谢。
我使用的脚本(编辑)
我使用下面的脚本g++-libc++在libc++之上运行g++,在Mac上运行MacPorts (因此是-mp名称)。
#! /bin/sh
clangxx=clang++-mp-3.5
gxx=g++-mp-4.9
libcxx_includes=$($clangxx -print-search-dirs |
perl -ne 's{^libraries: =(.*)}{$1/../../../} && print')
exec $gxx -std=c++11 \
-isystem ${libcxx_includes}/include/c++/v1 \
-nostdinc++ -nodefaultlibs \
-lc -lc++ -lc++abi -lgcc_s.10.5 \
-Wl,-no_compact_unwind \
"$@"发布于 2014-03-10 18:23:15
类似于:
g++ -std=c++0x -nostdinc++ -nodefaultlibs -lc -isystem <path_to>/include/c++/v1 -lc++ -lc++abi -lgcc_s.10.5
https://stackoverflow.com/questions/22228208
复制相似问题