Qt requires C++11 support" make error - c++

I tried Compile the latest tiled from source code following the instructions in README.md.
My working environment:
tiled source code: tiled-0.16.1
Mac OS: 10.11.1
Xcode : 7.1
QMake: 3.0
Qt: 5.7.0
Apple LLVM: 7.0.0
But the make failed with the following error:
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:61:4: error: "Qt requires C++11 support"
# error "Qt requires C++11 support"
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:13: error: unknown type name 'QAtomicOps'
typedef QAtomicOps<T> Ops;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:23: error: expected member name or ';' after declaration
specifiers
typedef QAtomicOps<T> Ops;
~~~~~~~~~~~~~~~~~~^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:93:23: error: use of undeclared identifier 'QAtomicOpsSupport'
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:746:66: note: expanded from macro 'Q_STATIC_ASSERT_X'
#define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:93:53: error: no member named 'IsSupported' in the global
namespace
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
~~^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:746:66: note: expanded from macro 'Q_STATIC_ASSERT_X'
#define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:14: error: use of undeclared identifier 'Ops'
typename Ops::Type _q_value;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:19: error: expected a qualified name after 'typename'
typename Ops::Type _q_value;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:23: error: expected ';' at end of declaration list
typename Ops::Type _q_value;
^
;
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:99:44: error: use of undeclared identifier 'Ops'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:99:54: error: use of undeclared identifier '_q_value'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:100:45: error: use of undeclared identifier 'Ops'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:100:56: error: use of undeclared identifier '_q_value'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:102:51: error: use of undeclared identifier 'Ops'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:102:68: error: use of undeclared identifier '_q_value'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:103:52: error: use of undeclared identifier 'Ops'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:103:70: error: use of undeclared identifier '_q_value'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:107:86: error: use of undeclared identifier 'Ops'
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:107:34: error: no return statement in constexpr function
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:108:88: error: use of undeclared identifier 'Ops'
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return Ops::isReferenceCountingWaitFree(); }
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [pythonplugin.o] Error 1
make[2]: *** [sub-python-make_first] Error 2
make[1]: *** [sub-plugins-make_first-ordered] Error 2
make: *** [sub-src-make_first-ordered] Error 2
After doing some research, I tried to add a line CONFIG+= c++11 to the tiled.pro file and then make clean , qmake, make but still I am having the same error ......
tiled.pro :
# Check the Qt version. If QT_VERSION is not set, it is probably Qt 3.
isEmpty(QT_VERSION) {
error("QT_VERSION not defined. Tiled does not work with Qt 3.")
}
include(tiled.pri)
!minQtVersion(5, 1, 0) {
message("Cannot build Tiled with Qt version $${QT_VERSION}")
error("Use at least Qt 5.1.0.")
}
TEMPLATE = subdirs
CONFIG += ordered
CONFIG += c++11
SUBDIRS = src translations
Not sure what goes wrong here.
Any advice will be appreciated, thanks :)
UPDATE:
Tried
QMAKE_CXXFLAGS += -std=c++11
and
QMAKE_CXXFLAGS += -std=c++0x
Still have the same error ......
I thought it might be in the C++ compile the make command use, here is some information :
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c `python-config --cflags` -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 -Wall -W -fPIC -DPYTHON_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../libtiled -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib/QtGui.framework/Headers -I/Users/supersuraccoon/Qt5.7.0/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/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/mkspecs/macx-clang -F/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib -o pythonplugin.o pythonplugin.cpp

I had a similar problem building poppler with Qt wrappers and got the same error: "Qt requires C++11 support".
My setup is:
Mac OS: 10.11.5
Xcode : 7.3.1
QMake: 3.0
Qt: 5.7.0
Apple LLVM: 7.3.0
All I did was:
export CXXFLAGS=-std=c++11
./configure
make
and it worked.

I know it has been a while.
How I finally solve this problem is adding in CMakeLists.txt the following line just after project(MyProject):
add_compile_options(-std=c++11)
That says to cmake, to create a Makefile that will use c++11 solving issues.

Related

cmake + qt + vtk: Compilation errors in macOS Mojave

I'm running macOS Mojave (10.14.3).
After the upgrade to Mojave something in my system changed and I no longer can compile code having VTK and Qt.
A (not) working example can be found in the examples given by VTK.
It's worth to mention, that I can compile the other examples not involving qt.
I use homebrew to install everything I need.
Hier are the logs:
cmake ..
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- VTK_VERSION: 8.1.2
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/chraibi/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build
and
make
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp:2:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/moc_SideBySideRenderWindowsQt.cpp:9:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/../../../SideBySideRenderWindowsQt.h:6:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qmainwindow.h:44:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qwidget.h:52:
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:51:82: error: invalid token at start of a preprocessor expression
#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:68:1: error: unknown type name 'Q_DECL_CONST_FUNCTION'
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:68:23: error: expected unqualified-id
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:91:5: error: unknown type name 'Q_ENUM'
Q_ENUM(Policy)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:91:19: error: expected ';' at end of declaration list
Q_ENUM(Policy)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:110:35: error: use of undeclared identifier 'ControlType'
Q_DECLARE_FLAGS(ControlTypes, ControlType)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:5: error: unknown type name 'Q_FLAG'
Q_FLAG(ControlTypes)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:12: error: duplicate member 'ControlTypes'
Q_FLAG(ControlTypes)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:110:21: note: previous declaration is here
Q_DECLARE_FLAGS(ControlTypes, ControlType)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:25: error: expected ';' at end of declaration list
Q_FLAG(ControlTypes)
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:132:5: error: unknown type name 'Q_DECL_RELAXED_CONSTEXPR'
Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) Q_DECL_NOTHROW { bits.horPolicy = d; }
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:132:30: error: expected member name or ';' after declaration specifiers
Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) Q_DECL_NOTHROW { bits.horPolicy = d; }
~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:136:73: error: expected ';' at end of declaration list
QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const Q_DECL_NOTHROW {
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:153:58: error: expected ';' at end of declaration list
QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const Q_DECL_NOTHROW { return static_cast<int>(bits.horStretch); }
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:176:47: error: expected ';' at end of declaration list
QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) Q_DECL_NOTHROW : data(i) { }
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:178:50: error: unknown type name 'Bits'
QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { }
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:178:57: error: expected ';' at end of declaration list
QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { }
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:223:9: error: unknown type name 'Bits'
Bits bits;
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:231:33: error: use of undeclared identifier 'Q_RELOCATABLE_TYPE'; did you mean 'Q_MOVABLE_TYPE'?
Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE);
^
/usr/local/include/QtCore/qglobal.h:2272:5: note: 'Q_MOVABLE_TYPE' declared here
Q_MOVABLE_TYPE = 0x2,
^
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp:2:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/moc_SideBySideRenderWindowsQt.cpp:9:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/../../../SideBySideRenderWindowsQt.h:6:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qmainwindow.h:44:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qwidget.h:52:
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:231:33: error: use of undeclared identifier 'Q_RELOCATABLE_TYPE'; did you mean 'Q_MOVABLE_TYPE'?
Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE);
^
/usr/local/include/QtCore/qglobal.h:2272:5: note: 'Q_MOVABLE_TYPE' declared here
Q_MOVABLE_TYPE = 0x2,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/SideBySideRenderWindowsQt.dir/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/SideBySideRenderWindowsQt.dir/all] Error 2
make: *** [all] Error 2
Similar error I get with cmake -DCMAKE_CXX_COMPILER=g++-8, where g++-8 is installed with brew
Maybe I should mention, there is a software using vtk and qt that I can install via brew without any problems. The same software cannot be compiled directly (cmake --> make).
Could be something with my OS is wrong?
Just uninstall the duplicate QT installations on your system, like the older qt4 version. Credits to khrykin

mingw-w64 & CLion cannot compile projects with assimp successfully

Using CLion & mingw-w64(7.2.0) to compile https://github.com/CasterKKK/OpenGLStarter, get the following errors:
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windows.h:70:0,
from C:/PROGRA~1/POSTGR~1/10/include/pthread.h:198,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:35,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/x86_64-w64-mingw32/bits/gthr.h:148,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/ext/atomicity.h:35,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/bits/basic_string.h:39,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/string:52,
from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/stdexcept:39,
from D:/Workspaces/CppWorkspace/OpenGLEngine/lib/assimp/include/assimp/Exceptional.h:44,
from D:/Workspaces/CppWorkspace/OpenGLEngine/lib/assimp/include/assimp/BaseImporter.h:47,
from D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBLoader.h:49,
from D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBLoader.cpp:48:
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:185:20: error: expected identifier before numeric constant
SPOT,LOCAL,INFINITE
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:185:20: error: expected '}' before numeric constant
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:185:20: error: expected unqualified-id before numeric constant
In file included from D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBLoader.cpp:49:0:
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:188:30: error: 'Assimp::COB::ChunkInfo' is not a namespace or unscoped enum
using ChunkInfo::operator=;
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:189:11: error: expected unqualified-id before ')' token
Light() : Node(TYPE_LIGHT),angle(),inner_angle(),ltype(SPOT) {}
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:194:5: error: 'LightType' does not name a type; did you mean 'Light'?
LightType ltype;
^~~~~~~~~
Light
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:200:1: error: expected class-name before '{' token
{
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:201:11: error: 'ChunkInfo' has not been declared
using ChunkInfo::operator=;
^~~~~~~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h: In constructor 'Assimp::Camera::Camera()':
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:202:16: error: class 'Assimp::Camera' does not have any field named 'Node'
Camera() : Node(TYPE_CAMERA) {}
^~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:202:21: error: 'TYPE_CAMERA' was not declared in this scope
Camera() : Node(TYPE_CAMERA) {}
^~~~~~~~~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:202:21: note: suggested alternative: 'TP_TIMER'
Camera() : Node(TYPE_CAMERA) {}
^~~~~~~~~~~
TP_TIMER
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h: At global scope:
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:216:1: error: expected class-name before '{' token
{
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:217:11: error: 'ChunkInfo' has not been declared
using ChunkInfo::operator=;
^~~~~~~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:249:1: error: expected class-name before '{' token
{
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:260:37: error: 'Node' was not declared in this scope
typedef std::deque< std::shared_ptr<Node> > NodeList;
^~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:260:37: note: suggested alternative:
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:105:8: note: 'Assimp::COB::Node'
struct Node : public ChunkInfo
^~~~
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:260:41: error: template argument 1 is invalid
typedef std::deque< std::shared_ptr<Node> > NodeList;
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:260:43: error: template argument 1 is invalid
typedef std::deque< std::shared_ptr<Node> > NodeList;
^
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:260:43: error: template argument 2 is invalid
D:\Workspaces\CppWorkspace\OpenGLEngine\lib\assimp\code\COBScene.h:275:1: error: expected declaration before '}' token
} // end Assimp
^
mingw32-make.exe[3]: *** [lib\assimp\code\CMakeFiles\assimp.dir\build.make:1645: lib/assimp/code/CMakeFiles/assimp.dir/COBLoader.cpp.obj] Error 1
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:332: lib/assimp/code/CMakeFiles/assimp.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:89: CMakeFiles/OpenGLEngine.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:163: OpenGLEngine] Error 2
But if I open and compile it with Visual Studio 2017, it works fine...
Here is the CLion's setting:
I used the command line cmake -G"Visual Studio 15 2017 Win64" .. to compile the code, and it works fine, but I cannot set Visual Studio in CLion, for it cannot find C:\Program Files (x86)\Microsoft Visual Studio\2017\Community even my VS 2017 is right there, which is really weird...
The problem is that the project on Github was never build with mingw, thus the issues you are seeing. Better stick to VS or clang compilers.

Errors while compiling DeSiNe

While I run make build for the project DeSiNe [Click to go to github page], I am getting the error ‘Topology’ does not name a type
$ make build
mkdir -m 755 -p obj/Algorithm
g++ -Wall -DNO_TIMER -DNO_TRACES -O3 -funroll-loops -finline-functions -fexpensive-optimizations -Isrc -o obj/Algorithm/Algorithm.o -c src/Algorithm/Algorithm.cpp
In file included from src/Network/TopologyFactory.h:21:0,
from src/Network/Topology.h:25,
from src/Network/Flow.h:20,
from src/Algorithm/Algorithm.h:20,
from src/Algorithm/Algorithm.cpp:14:
src/RandomVariables/RandomNumberGenerator.h: In member function ‘double RandomNumberGenerator::generate()’:
src/RandomVariables/RandomNumberGenerator.h:158:43: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
return (double) 2.0 - (*(float*) &itemp);
^
In file included from src/Network/Topology.h:25:0,
from src/Network/Flow.h:20,
from src/Algorithm/Algorithm.h:20,
from src/Algorithm/Algorithm.cpp:14:
src/Network/TopologyFactory.h: At global scope:
src/Network/TopologyFactory.h:76:5: error: ‘Topology’ does not name a type
Topology* create(const TString &description);
^
src/Network/TopologyFactory.h:84:48: error: ‘Topology’ has not been declared
void build(const NodePairDeque &nodepairs, Topology* topology);
^
src/Network/TopologyFactory.h:92:5: error: ‘Topology’ does not name a type
Topology* createTopologyAdjacency(const TString &description);
^
src/Network/TopologyFactory.h:103:5: error: ‘Topology’ does not name a type
Topology* createTopologyBarabasi(const TString &description);
^
src/Network/TopologyFactory.h:112:5: error: ‘Topology’ does not name a type
Topology* createTopologyErdos(const TString &description);
^
src/Network/TopologyFactory.h:120:5: error: ‘Topology’ does not name a type
Topology* createTopologyFile(const TString &description);
^
src/Network/TopologyFactory.h:129:5: error: ‘Topology’ does not name a type
Topology* createTopologyFull(const TString &description);
^
src/Network/TopologyFactory.h:138:5: error: ‘Topology’ does not name a type
Topology* createTopologyGrid2D(const TString &description);
^
src/Network/TopologyFactory.h:147:5: error: ‘Topology’ does not name a type
Topology* createTopologyRandom(const TString &description);
^
make: *** [Algorithm/Algorithm] Error 1
but the included Topology.h does contain
class Topology : public AbstractNetworkElement
{
// Friend(s)
How to resolve?
EDIT:
Adding forward declaration for class Topology gives further error:
In file included from src/Algorithm/SamcraBAlgorithm.h:22:0,
from src/Algorithm/SamcraBAlgorithm.cpp:17:
src/Utils/TString.h:25:7: error: using typedef-name ‘Types::TString’ after ‘class’
class TString
^
In file included from src/LinkStateUpdate/LinkStateUpdateVisitor.h:23:0,
from src/Network/Link.h:19,
from src/Network/Topology.h:23,
from src/Network/Flow.h:20,
from src/Algorithm/Algorithm.h:22,
from src/Algorithm/SamcraBAlgorithm.cpp:16:
src/Utils/Types.h:65:24: note: ‘Types::TString’ has a previous declaration here
typedef deque<string> TString;
^
make: *** [Algorithm/SamcraBAlgorithm] Error 1
Basically the project has four main compilation problems:
Circular include dependency between TopologyFactory and Topology classes.
Including TString.h header directly when is meant to be used as a typedef.
Missing cstdlib/cstdio includes.
Member initialization in class definition (not available until C++11).
The fix for the first one involves removing TopologyFactory from the Topology header, thus breaking the circular include dependency. Then including the TopologyFactory header where is needed.
The second one is easy to fix: just remove the TString header includes so it uses the definition at Utils/Types.h by default.
Third fix is trivial: just add the cstdio/cstdlib includes where needed.
The last fix involves moving the static initialization to the definition file (maybe the author was using an old compiler with an extension who allowed this type of initialization).
I made a patch on this gist so you can see the changes. The project compiles with g++ 5.2.1 on Ubuntu 15.10.
There is a cross-reference in the code.
Topology.h includes TopologyFactory.h and vice versa TopologyFactory.h included Topology.h
The most easy way to fix it add forward declaration for class Topology into TopologyFactory.h:
#ifndef TOPOLOGYFACTORY_H
#define TOPOLOGYFACTORY_H
...
class Topology;
class TopologyFactory
{
More correct approach would be try to solve these dependencies, i.e. don't include TopologyNetwork.h in Topology.h and then in all cpp files which using TopologyNetwork and Topology add two include directives:
/*
source file DesineModel.cpp for class: DesineModel
...
*/
...
#include "Network/Topology.h"
#include "Network/TopologyFactory.h"
...

Configure Eclipse CDT or Codeblocks to get LLVM IR intellisense

I want to configure Eclipse (or Codeblocks) so that when I write a pass, I can at least take advantage of Intellisense (even if building passes directly from within Eclipse is not possible). Update: I am getting at least some intellisense once I enabled Parsing-based Proposals in Eclipse (details below)
So far I have configured Eclipse to use clang to compile simple C++ programs.
To get intellisense for LLVM pass, I added /usr/local/include to Includes directories and tried code:
#include <iostream>
#include <llvm/IR/Function.h>
using namespace std:
int main() {
cout << "Hello World" << endl;
return 0;
}
It doesn't fail on #include <llvm/IR/Function.h> itself (i.e. it can find this header file), but upon including subsequent files, gives me
/usr/local/include/llvm/Support/DataTypes.h:58:3: error: "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
Any pointers to how I could make it give me intellisense at least?
Complete Log
01:22:48 **** Rebuild of configuration Debug for project HelloWorld2 ****
Info: Internal Builder is used for build
clang++ -I/usr/local/include -O0 -emit-llvm -g3 -Wall -c -fmessage-length=0 -o src/HelloWorld2.bc ../src/HelloWorld2.cpp
In file included from ../src/HelloWorld2.cpp:10:
In file included from /usr/local/include/llvm/IR/Function.h:22:
In file included from /usr/local/include/llvm/IR/Argument.h:17:
In file included from /usr/local/include/llvm/ADT/Twine.h:14:
/usr/local/include/llvm/Support/DataTypes.h:58:3: error: "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
^
/usr/local/include/llvm/Support/DataTypes.h:62:3: error: "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
# error "Must #define __STDC_CONSTANT_MACROS before " \
^
In file included from ../src/HelloWorld2.cpp:10:
In file included from /usr/local/include/llvm/IR/Function.h:22:
In file included from /usr/local/include/llvm/IR/Argument.h:19:
In file included from /usr/local/include/llvm/IR/Attributes.h:19:
In file included from /usr/local/include/llvm/ADT/ArrayRef.h:14:
In file included from /usr/local/include/llvm/ADT/SmallVector.h:20:
/usr/local/include/llvm/Support/MathExtras.h:273:24: error: use of undeclared identifier 'INT64_C'
return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
^
/usr/local/include/llvm/Support/MathExtras.h:273:56: error: use of undeclared identifier 'INT64_C'
return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
^
/usr/local/include/llvm/Support/MathExtras.h:299:26: error: use of undeclared identifier 'UINT64_C'
return N >= 64 || x < (UINT64_C(1)<<(N));
^
/usr/local/include/llvm/Support/MathExtras.h:331:24: error: use of undeclared identifier 'INT64_C'
return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
^
/usr/local/include/llvm/Support/MathExtras.h:331:56: error: use of undeclared identifier 'INT64_C'
return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
^
In file included from ../src/HelloWorld2.cpp:10:
In file included from /usr/local/include/llvm/IR/Function.h:22:
In file included from /usr/local/include/llvm/IR/Argument.h:19:
In file included from /usr/local/include/llvm/IR/Attributes.h:19:
In file included from /usr/local/include/llvm/ADT/ArrayRef.h:14:
/usr/local/include/llvm/ADT/SmallVector.h:232:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
void push_back(T &&Elt) {
^
/usr/local/include/llvm/ADT/SmallVector.h:476:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
iterator insert(iterator I, T &&Elt) {
^
/usr/local/include/llvm/ADT/SmallVector.h:645:46: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
SmallVectorImpl &operator=(SmallVectorImpl &&RHS);
^
/usr/local/include/llvm/ADT/SmallVector.h:383:12: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
for (auto I = this->end(), E = this->begin() + N; I != E; ++I)
^
/usr/local/include/llvm/ADT/SmallVector.h:764:70: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) {
^
/usr/local/include/llvm/ADT/SmallVector.h:878:27: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
SmallVector(SmallVector &&RHS) : SmallVectorImpl<T>(N) {
^
/usr/local/include/llvm/ADT/SmallVector.h:883:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
const SmallVector &operator=(SmallVector &&RHS) {
^
In file included from ../src/HelloWorld2.cpp:10:
In file included from /usr/local/include/llvm/IR/Function.h:22:
In file included from /usr/local/include/llvm/IR/Argument.h:19:
In file included from /usr/local/include/llvm/IR/Attributes.h:20:
In file included from /usr/local/include/llvm/ADT/FoldingSet.h:21:
/usr/local/include/llvm/Support/Allocator.h:134:70: error: expected expression
BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>> {
^
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected a type
};
^
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected class name
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected '{' after base class list
/usr/local/include/llvm/Support/Allocator.h:362:53: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
SpecificBumpPtrAllocator(SpecificBumpPtrAllocator &&Old)
^
/usr/local/include/llvm/Support/Allocator.h:366:64: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
SpecificBumpPtrAllocator &operator=(SpecificBumpPtrAllocator &&RHS) {
^
/usr/local/include/llvm/Support/Allocator.h:375:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
auto DestroyElements = [](char *Begin, char *End) {
^
/usr/local/include/llvm/Support/Allocator.h:375:28: error: expected expression
auto DestroyElements = [](char *Begin, char *End) {
^
/usr/local/include/llvm/Support/Allocator.h:381:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E;
^
/usr/local/include/llvm/Support/Allocator.h:381:29: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E;
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:381:58: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E;
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:383:52: error: no member named 'computeSlabSize' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
size_t AllocatedSlabSize = BumpPtrAllocator::computeSlabSize(
~~~~~~~~~~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:384:35: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
std::distance(Allocator.Slabs.begin(), I));
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:386:35: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
char *End = *I == Allocator.Slabs.back() ? Allocator.CurPtr
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:386:60: error: no member named 'CurPtr' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
char *End = *I == Allocator.Slabs.back() ? Allocator.CurPtr
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:392:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
for (auto &PtrAndSize : Allocator.CustomSizedSlabs) {
^
/usr/local/include/llvm/Support/Allocator.h:392:39: error: no member named 'CustomSizedSlabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>'
for (auto &PtrAndSize : Allocator.CustomSizedSlabs) {
~~~~~~~~~ ^
/usr/local/include/llvm/Support/Allocator.h:392:27: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
for (auto &PtrAndSize : Allocator.CustomSizedSlabs) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
13 warnings and 20 errors generated.
01:22:50 Build Finished (took 1s.509ms)
UPDATE: Eclipse does give me intellisense (at least some of it), I had to check Parsing-based Proposals in Window -> Preferences -> C/C++ -> Editor -> Content Assist -> Advanced (It was unchecked by default).
This is not answering the question directly, but it will ensure, you have a correctly working build environment. It is specific for code blocks.
First checkout the source tree of llvm (directly taken from the getting started guide):
git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
cd ..
cd projects
git clone http://llvm.org/git/compiler-rt.git
git clone http://llvm.org/git/libcxx.git
git clone http://llvm.org/git/libcxxabi.git
git clone http://llvm.org/git/test-suite.git
git clone http://llvm.org/git/openmp.git
Remove anything you don't like.
Then create an directory outside the llvm directory:
cd ..
mkdir build
Change your directory (cd) to there and run:
cd build
cmake -g "CodeBlocks - Unix Makefiles" <your configure options> ../llvm
Assuming llvm shares the root path, otherwise change the ../llvm line to the correct path. Then open it as an existing project in code::blocks.
If all went well, your build environment is setup correctly and code completion should work.

Unable to setup gtkmm

I am trying to setup gtkmm on my Windows 7 system. I have installed Glade 3.6.1 and gtkmm Development Environment 2.22.0-2.
When I tried to run the sample code below, I am unable to compile and run.
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return 0;
}
The compile log:
Compiler: Default compiler Building Makefile:
"C:\Dev-Cpp\Makefile.win" Executing make... make.exe -f
"C:\Dev-Cpp\Makefile.win" main.o g++.exe -c main.cpp -o main.o
-I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -mms-bitfields -IC:/GTK/include/gtkmm-2.4 -IC:/GTK/lib/gtkmm-2.4/include -IC:/GTK/include/atkmm-1.6 -IC:/GTK/include/giomm-2.4 -IC:/GTK/lib/giomm-2.4/include -IC:/GTK/include/pangomm-1.4 -IC:/GTK/lib/pangomm-1.4/include -IC:/GTK/include/gtk-2.0 -IC:/GTK/include/gdkmm-2.4 -IC:/GTK/lib/gdkmm-2.4/include -IC:/GTK/include/atk-1.0 -IC:/GTK/include/glibmm-2.4 -IC:/GTK/lib/glibmm-2.4/include -IC:/GTK/include/glib-2.0 -IC:/GTK/lib/glib-2.0/include -IC:/GTK/include/sigc++-2.0 -IC:/GTK/lib/sigc++-2.0/include -IC:/GTK/include/cairomm-1.0 -IC:/GTK/lib/cairomm-1.0/include -IC:/GTK/include/pango-1.0 -IC:/GTK/include/cairo -IC:/GTK/include -IC:/GTK/include/freetype2 -IC:/GTK/include/libpng14 -IC:/GTK/lib/gtk-2.0/include -IC:/GTK/include/gdk-pixbuf-2.0 -IC:/GTK/include/libglademm-2.4
In file included from
C:/GTK/include/glibmm-2.4/glibmm/containerhandle_shared.h:24,
from C:/GTK/include/glibmm-2.4/glibmm/arrayhandle.h:23,
from C:/GTK/include/glibmm-2.4/glibmm.h:82,
from C:/GTK/include/gtkmm-2.4/gtkmm.h:87,
from main.cpp:1: C:/GTK/include/glibmm-2.4/glibmm/ustring.h:861: error: ISO C++ forbids
declaration of wostringstream' with no type
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:861: error: expected;'
before "StreamType" C:/GTK/include/glibmm-2.4/glibmm/ustring.h:865:
error: `StreamType' does not name a type
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:906: error: expected
constructor, destructor, or type conversion before '&' token
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:906: error: expected ,' or
;' before '&' token C:/GTK/include/glibmm-2.4/glibmm/ustring.h:912:
error: expected constructor, destructor, or type conversion before '&'
token C:/GTK/include/glibmm-2.4/glibmm/ustring.h:912: error: expected
,' or;' before '&' token
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(const T&)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1057: error:stream_'
undeclared (first use this function)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1057: error: (Each
undeclared identifier is reported only once for each function it
appears in.)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(const char*)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1063: error:stream_'
undeclared (first use this function)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(char*)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1069: error:stream_'
undeclared (first use this function)
make.exe: * [main.o] Error 1
Execution terminated
Any help with the setup would be greatly appreciated.
Thanks!