我正在尝试使用Clang ++编译我在网上找到的程序.Makefile生成以下命令:
clang++ -c -arch x86_64 -msse3 -std=c++11 -stdlib=libstdc++ -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-non-virtual-dtor -Wno-exit-time-destructors -Wformat -Wmissing-braces -Wparentheses -Wno-switch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wno-shorten-64-to-32 -Wenum-conversion -Wno-newline-eof -Wno-c++11-extensions -Wno-logical-op-parentheses -Wno-trigraphs -Wno-invalid-offsetof -Wno-sign-conversion -Wdeprecated-declarations -fmessage-length=0 -fno-exceptions -fstrict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -funsafe-math-optimizations -ftrapping-math -fno-rtti -fpascal-strings -fasm-blocks -O3 -Iinclude/ src/main.cpp
但我明白了
src/main.cpp:23:10: fatal error: 'unordered_map' file not found #include^ 1 error generated.
如果我编译一个包含
运行的简单程序clang++ test.cpp
,它编译得很好.
我上线了
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix
over_optimis.. 6
编译glogg时,我遇到了同样的问题。
正如评论所指出的。那是stdlib。
在运行qmake之后在makefile中。将此行从
CXXFLAGS = -g -Wextra -std=c++11 -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
到下面的这一行
CXXFLAGS = -g -Wextra -std=c++11 -stdlib=libc++ -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
注意cxxflags中指定了“ -stdlib = libc ++”。它是在链接器标志中自动指定的,我猜也需要在C ++标志中指定它。
编译glogg时,我遇到了同样的问题。
正如评论所指出的。那是stdlib。
在运行qmake之后在makefile中。将此行从
CXXFLAGS = -g -Wextra -std=c++11 -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
到下面的这一行
CXXFLAGS = -g -Wextra -std=c++11 -stdlib=libc++ -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
注意cxxflags中指定了“ -stdlib = libc ++”。它是在链接器标志中自动指定的,我猜也需要在C ++标志中指定它。