简体   繁体   中英

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: CPP的CLion工具链 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM