0

I want to compile a c++ source code that i found. The code works well on linux (Qt), but on Mac OS X (10.9.5) i have this error on QT :

/Users/Anass/test2/segmenter.h:19: erreur : 'unordered_map' file not    
found
#include <unordered_map>
         ^

and when i replace the

"#include <unordered_map>" by "#include<tr1/unordered_map>" 

the line is underlined with green and the error change to this line where :

/Users/Anass/test2/segmenter.h:21: erreur : 'unordered_set' file not    
found
#include <unordered_set>
         ^

I kept the same .pro file (defined for linux) :

QT       += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Superfacets
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app

QMAKE_CXXFLAGS_RELEASE += -fpermissive
QMAKE_CXXFLAGS_DEBUG += -fpermissive
QMAKE_CXXFLAGS += -std=c++0x
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3


SOURCES += main.cpp \
Vertex3D.cpp \
Vertex2D.cpp \
Triangle.cpp \
Timer.cpp \
segmenter.cpp \
Reader.cpp \
normals.cpp \
meshvisualizer.cpp \
Edge.cpp \
dialogs.cpp \
colormapper.cpp

HEADERS += \
Vertex3D.h \
Vertex2D.h \
Triangle.h \
Timer.h \
Sorting.h \
segmenter.h \
Reader.h \
normals.h \
meshvisualizer.h \
Mesh.h \
Edge.h \
dialogs.h \
colormapper.h


LIBS += -lGLU

The clang version is :

clang --version
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

I searched on google and i found that it could be related to "stdlib" but i'm really a specialist of compiling.

Any help please?

Anass
  • 251
  • 2
  • 15
  • they were a commenst here, but they disappear how come ? – Anass Feb 06 '16 at 19:56
  • 1
    Try to compile with `-std=c++11` istead of `-std=c++0x` – Revolver_Ocelot Feb 06 '16 at 19:59
  • i replace QMAKE_CXXFLAGS += -std=c++0x by QMAKE_CXXFLAGS += -std=c++11 , but the issue still exists – Anass Feb 06 '16 at 20:04
  • Check those answers: [What could cause clang to not find the unordered_map header?](http://stackoverflow.com/questions/26233011/what-could-cause-clang-to-not-find-the-unordered-map-header) and [Why some include files only reside in tr1?](http://stackoverflow.com/questions/7870897/why-some-include-files-only-reside-in-tr1) – Revolver_Ocelot Feb 06 '16 at 20:16
  • yes, i saw theses ones. However when i add the "-stdlib=libc++" i get this new issue : erreur : invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)" – Anass Feb 06 '16 at 20:52

1 Answers1

0

A quick Google reveals this fix. Add

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7

to your .pro file along with the aforementioned

QMAKE_CXXFLAGS += -std=c++11
Community
  • 1
  • 1
iksemyonov
  • 4,106
  • 1
  • 22
  • 42