什么可能导致clang找不到unordered_map头? [英] What could cause clang to not find the unordered_map header?

查看:890
本文介绍了什么可能导致clang找不到unordered_map头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译一个程序,我发现在网络上使用Clang ++。 Makefile生成以下命令:

I'm trying to compile a program I found on the web using Clang++. The Makefile generates this command:

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 <unordered_map>
         ^
1 error generated.

如果我编译一个包含< unordered_map> 运行 clang ++ test.cpp ,它编译良好

If I compile a simple program that includes <unordered_map> running clang++ test.cpp, it compiles fine.

'm on

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix


推荐答案

我在编译glogg时遇到同样的问题。

I had the same issue when compiling glogg.

正如评论所指出的。它是stdlib。

As the comments have pointed out. it was stdlib.

在运行qmake后的makefile中。从

In the makefile after running qmake. Change this line from

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)

通知-stdlib = libc ++在cxxflags中指定。它是在链接器标志中自动指定的,我想它也需要为C ++标志指定。

notice "-stdlib=libc++" was specified in the cxxflags. It's autospecified in the linker flags, I guess it also needs to be specified in for the C++ flags.

这篇关于什么可能导致clang找不到unordered_map头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆