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

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

我正在尝试在 mac (OS X 10.11.6) 上编译 Qscintilla 2.9.3(获得 here),但是 make 步骤失败并出现以下错误:

/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;

根据有关该主题的其他问题,我添加了

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

在 qscintilla.pro 文件中,无济于事。

这个thread似乎显示了类似的问题。它是通过抑制依赖项中的 -ansi 标志解决的,这阻止了 c++11 的使用。但是我在上面的日志中没有看到这样的标志。

您是否知道可能导致该问题的原因?

我有 QMake 3.0 版和 Qt 5.7。

感谢上面关于所用编译器的评论,我在 this thread 上发现,为了在 Mac 上将 c++11 与 clang/llvm 一起使用,还需要使用库 -stdlib=libc++ 而不是旧的 libstdc++。

添加

问题就这样解决了
QMAKE_LFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -stdlib=libc++

到 .pro 文件。