Don't panic
Don't panic

Reputation: 303

Qscintilla make error : "Qt requires C++11 support"

I am trying to compile Qscintilla 2.9.3 (obtained here) on mac (OS X 10.11.6), but the make step fails with the following error :

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -c -pipe -O2 -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.8 -fvisibility=hidden -fvisibility-inlines-hidden -w -fPIC -DQSCINTILLA_MAKE_DLL -DSCINTILLA_QT -DSCI_LEXER -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_MACEXTRAS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I../include -I../lexlib -I../src -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtPrintSupport.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtMacExtras.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtGui.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/mkspecs/macx-g++ -F/Applications/Utilities/Qt/5.7/clang_64/lib -o qsciscintilla.o qsciscintilla.cpp
In file included from qsciscintilla.cpp:23:
In file included from ./Qsci/qsciscintilla.h:29:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/QByteArray:1:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbytearray.h:44:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qrefcount.h:43:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:41:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:61:4: error:
"Qt requires C++11 support"
# error "Qt requires C++11 support"
^
/Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:13: error:
unknown type name 'QAtomicOps'
typedef QAtomicOps Ops;

Following other questions on the subject, I have added

\# With C++11 support  
greaterThan(QT_MAJOR_VERSION, 4){      
CONFIG += c++11  
} else {  
QMAKE_CXXFLAGS += -std=c++0x  
}  

in the qscintilla.pro file, to no avail.

This thread seems to show a similar problem. It was solved by suppressing an -ansi flag in a dependency, which prevented the use of c++11. However I do not see such a flag in the log above.

Do you have an idea as to what could cause that problem ?

I have QMake version 3.0 and Qt 5.7.

Upvotes: 0

Views: 1663

Answers (1)

Don't panic
Don't panic

Reputation: 303

Thanks to the remarks above regarding the compiler used, I found on this thread that in order to use c++11 with clang/llvm on Mac, it is necessary to also use the library -stdlib=libc++ instead of the old libstdc++.

The problem was thus solved by adding

QMAKE_LFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -stdlib=libc++

to the .pro file.

Upvotes: 4

Related Questions