与mingw-w64(WinBuilds)的Assimp链接错误

时间:2020-10-05 09:40:46

标签: c++ linker mingw-w64 assimp

我正在尝试使用mingw-w64(x86_64-w64-mingw32-g ++)编译使用assimp的项目,并且链接器会产生以下错误:

MyCustomExtension.getPriority

看起来链接程序无法将assimp的动态库与项目链接。我使用.dll和.lib文件,它们是从最新的assimp源(使用CMake和Visual Studio)编译而来的,而链接程序找不到的功能则显示在dll和lib中(已通过dumpbin检查)。所有文件都是x64位。

这是我的编译方式:

render/model.o: In function `Model::loadModel(std::string)': render/model.cpp:9: undefined reference to `Assimp::Importer::Importer()' render/model.cpp:15: undefined reference to `Assimp::Importer::GetErrorString() const' render/model.cpp:20: undefined reference to `Assimp::Importer::~Importer()' render/model.cpp:20: undefined reference to `Assimp::Importer::~Importer()' render/model.o: In function `Assimp::Importer::ReadFile(std::string const&, unsigned int)': include/assimp/Importer.hpp:653: undefined reference to `Assimp::Importer::ReadFile(char const*, unsigned int)'

已经尝试使用旧的预编译二进制文件,它产生相同的结果。试图使用mingw-w64编译assimp,但失败了。

任何想法会导致链接器看不到功能吗?

1 个答案:

答案 0 :(得分:0)

我用MSYS2(g ++ 10.2.0)替换了WinBuild(g ++ 4.8.0),并用mingw重新编译了assimp。现在,项目中的所有内容都可以正常编译。