2016-10-28 104 views
1

在我的項目中的文件失敗,「unordered_map」在Xcode編譯時未找到文件錯誤7.3.1

'unordered_map' file not foundIn file included from ...

儘管這是我與-std = C++和具有目錄編譯編譯其中的unordered_map在系統包含路徑中。

clang -std=c++14 -x c++ -v -E /dev/null

結果在下面的輸出。 /Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1確實包含unordered_map

Apple LLVM version 7.3.0 (clang-703.0.31) 
Target: x86_64-apple-darwin15.6.0 
Thread model: posix 
InstalledDir: /Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 
"/Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -main-file-name null -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 264.3.102 -v -dwarf-column-info -resource-dir /Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0 -stdlib=libc++ -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /Users/ovz -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c++ /dev/null 
clang -cc1 version 7.3.0 (clang-703.0.31) default target x86_64-apple-darwin15.6.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: /Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 
/usr/local/include 
/Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/include 
/Applications/Xcode_7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
+1

你有'#include'作爲''unordered_map「'還是''? – Leon

+0

您是否試過'-stdlib = libC++' – Danh

+0

@Leon它是

回答

2

您需要通過此選項:

-stdlib=libc++ 

選擇libc++

我聽說有人說AppleClang默認使用舊版本libstdc++(可能是g++)。我不確定他們爲什麼做出這個決定(不用說,這在GNU/Linux中是可以理解的,因爲大部分時間,GNU/Linuxg++出貨libstdc++)。

相關問題