【问题标题】:mingw-w64 & CLion cannot compile projects with assimp successfullymingw-w64 & CLion 无法使用 assimp 成功编译项目
【发布时间】:2019-05-31 14:49:45
【问题描述】:

使用CLion & mingw-w64(7.2.0) 编译https://github.com/CasterKKK/OpenGLStarter,得到如下错误:

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

但如果我用 Visual Studio 2017 打开并编译它,它工作正常...

这是 CLion 的设置: 我使用命令行cmake -G"Visual Studio 15 2017 Win64" ..编译代码,它工作正常,但我无法在CLion中设置Visual Studio,因为它找不到C:\Program Files (x86)\Microsoft Visual Studio\2017\Community,即使我的VS 2017就在那里,这真的很奇怪......

【问题讨论】:

    标签: c++ visual-studio cmake clion assimp


    【解决方案1】:

    问题是 Github 上的项目从未使用 mingw 构建,因此您看到了这些问题。最好坚持使用 VS 或 clang 编译器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-27
      • 1970-01-01
      • 2019-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多