What can cause clang not to find the unordered_map header?

I am trying to compile a program that I found on the Internet using Clang ++. The makefile generates the following 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 

But I get

 src/main.cpp:23:10: fatal error: 'unordered_map' file not found #include <unordered_map> ^ 1 error generated. 

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

I'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 
+5
source share
2 answers

I had the same problem when compiling glogg.

As noted in the comments. it was stdlib.

In the makefile after running qmake. Change this line with

 CXXFLAGS = -g -Wextra -std=c++11 -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES) 

In this line below

 CXXFLAGS = -g -Wextra -std=c++11 -stdlib=libc++ -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES) 

note "-stdlib = libC ++" is specified in cxxflags. It is auto-specialized in linker flags, I think it should also be specified for C ++ flags.

+4
source

It says -Wno-C ++ 11-extension. What did this makefile write?

-2
source

Source: https://habr.com/ru/post/1204157/


All Articles