0

I'm writing a small OpenGL project for an exam, and I need to link Assimp to the project through CMake. (https://github.com/LordRibblesdale/CotecchioGame). I'm using MinGW64 and I didn't manage to build Assimp libraries via mingw32-make

undefined reference to Assimp::Importer::Importer()'
undefined reference to Assimp::Importer::~Importer()'
undefined reference to Assimp::Importer::ReadFile(char const*, unsigned int)'

So I downloaded mingw-w64-x86_64-assimp (5.0.1-2) from msys2 package collection and included them into the project, linked them through CMake here

target_link_libraries(${PROJECT_NAME} "${CMAKE_SOURCE_DIR}/Graphics/assimp/libassimp.dll.a")

But, after everything is compiled, put libassimp.dll from MSYS2 package into executable root

Executable.exe & libassimp.dll

I have this result

The procedure entry point _ZNSt7__cxx1118basic_stringstreamlcSt11char_traitslcESalcEEC1Ev could not be located in the dynamic link library C:\User\Green\CLionProjects\CotecchioGame\libassimp.dll

Am I missing something about library linking, or library calling where I'm using it? (return 0; is only for checking that everything is good

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

int main(int argc, char** argv) {
   std::string s("C:\\Users\\Green\\CLionProjects\\CotecchioGame\\Test.fbx");
   Assimp::Importer importer;
   std::unique_ptr<const aiScene> scene(importer.ReadFile(s, aiProcess_Triangulate));

   if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) {
      return 0;
   }
}

Or isn't this the correct library instead (or other libraries are needed to be linked (even if the error is related to libassimp.dll))?

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 2
    Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please try to make your questions *self-contained* without the need for half a dozen links to visit (links can go away, or the contents might change, making your question worthless for future visitors). – Some programmer dude Jun 09 '20 at 07:56
  • I think you'll either need to copy `libstdc++-6.dll` and `libgcc_s_*.dll` as well, or, build the application with `-DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc"` – Nehal J Wani Jun 10 '20 at 05:36
  • I've copied libstdc++-6.dll and libgcc_s_seh-1.dll from MinGW libraries but the result is the same, with the same error from libassimp.dll. Tried with `set(CMAKE_CXX_FLAGS "-static-libstdc++ -static-libgcc" CACHE STRING "compile flags" FORCE)` (if it is correct to use in CMakeLists.txt), but had the same result – LordRibblesdale Jun 10 '20 at 08:49
  • I've temporary solved this issue downgrading from Assimp 5.0.1-2 to 4.1.0-3, which didn't give me the error and runs flawlessly. I've read something about similar problems related to GCC compiler version between library and written code that will use it. PS: a similar problem to mine https://stackoverflow.com/questions/44573802/using-stdstring-causes-windows-entry-point-not-found – LordRibblesdale Jun 10 '20 at 21:22
  • @lordRibblesdale I have the same problem. How did you downgrade it? – Rancs Nov 03 '20 at 08:06
  • MSYS2 provides all libraries for MinGW to be implemented in include directories (if I remember well). EDIT, from mobile, sorry. https://packages.msys2.org/package/mingw-w64-x86_64-assimp here there is the last version. But I cannot find right now the older version but it is in the same website – LordRibblesdale Nov 04 '20 at 09:10
  • @LordRibblesdale The version 4.1 is no longer available on msys2. Can you share the lib you downloaded with me? (a, dll, exe) – Rancs Nov 05 '20 at 14:05
  • Never mind. I found the older package on internet. Thanks. – Rancs Nov 05 '20 at 14:52

0 Answers0