上下文:
you@laptop:~$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
每当我尝试make
需要c++11
支持的脚本时,我会得到以下输出:
致命错误:' initializer_list'找不到文件
我尝试将-stdlib=libc++
和-std=c++11
添加到CXXFLAGS
但没有成功。
如何解决'initializer_list'
错误?
我仔细检查了find /usr/include -name initializer_list
并返回:
的/ usr /包括/ C ++ / 4.9 / initializer_list
的/ usr /包括/ C ++ / 5 / initializer_list
编辑:这是Makefile。
答案 0 :(得分:0)
您可以运行以下命令来查看包含文件的搜索路径:
# clang++ -E -x c++ - -v < /dev/null
对于我正在使用输出的Docker镜像如下:
clang version 3.5.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
"/opt/llvm/bin/clang-3.5" -cc1 -triple x86_64-unknown-linux-gnu -E -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -resource-dir /opt/llvm/bin/../lib/clang/3.5.1 -internal-isystem /opt/llvm/bin/../include -internal-isystem /usr/local/include -internal-isystem /opt/llvm/bin/../lib/clang/3.5.1/include -internal-externc-isystem /opt/llvm/include/c++/v1 -internal-externc-isystem /usr/include -internal-externc-isystem /usr/include/ -internal-externc-isystem /usr/include/x86_64-linux-gnu/ -fdeprecated-macro -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o - -x c++ -
clang -cc1 version 3.5.1 based upon LLVM 3.5.1svn default target x86_64-unknown-linux-gnu
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/llvm/bin/../include
/usr/local/include
/opt/llvm/bin/../lib/clang/3.5.1/include
/opt/llvm/include/c++/v1
/usr/include
/usr/include/x86_64-linux-gnu
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 318 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
编译器抱怨它无法在&lt; ...&gt;的路径列表中找到initializer_list
搜索。
我能够在这个目录中找到它:
# find /opt/llvm/include/c++/v1 -name initializer_list
/opt/llvm/include/c++/v1/initializer_list
我建议检查您的LLVM安装是否与上面显示的默认搜索路径设置相符。