I have been trying to install Assimp 3.0 recently to load models from Blender to use in OpenGL.
My project is setup in Sublime Text 3, so I have created CMake files to generate the required make files for me to build my project.
All of the other libraries I am using, for example SFML, are being included and linked fine, but for some reason Assimp isn't working.
On build I get the following linker errors:
undefined reference to `Assimp::Importer::Importer()
undefined reference to `Assimp::Importer::~Importer()
undefined reference to `Assimp::Importer::~Importer()
Since this is a linker error I am under the assumption that my problem lies in my CMake files.
I created a FindASSIMP.cmake file to set some variables for me with the correct include directory and the path of the .lib files that need to be linked, and I can see that it is working fine because I can print the resulting variables and get the expected output.
I have two variables ${ASSIMP_INCLUDE_DIR} and ${ASSIMP_LIBRARY}.
In a release build:
${ASSIMP_INCLUDE_DIR} = C:/lib/assimp/3.0/include
${ASSIMP_LIBRARY} = C:/lib/assimp/3.0/lib/assimp_release-dll_win32/assimp.lib
My main CMake file which brings everything together goes something like this (with a lot of unrelated stuff stripped out):
set(EXE "main")
# Add sub-directories to create libraries from my files
add_subdirectory(various_sub_dirs)
add_executable(${EXE} my_sources.cpp)
# Link up my sub-directory libraries
target_link_libraries(${EXE} various_libraries_from_my_code)
# Link up external libraries
target_link_libraries(${EXE} ${ASSIMP_LIBRARY})
target_link_libraries(${EXE} ${GLEW_LIBRARIES})
target_link_libraries(${EXE} ${GLUT_LIBRARY})
target_link_libraries(${EXE} ${OPENGL_LIBRARIES})
# etc...
I don't get any include errors, so I know the inlcude directory is being used correctly, but for some reason, even though I can print out the exact path to the .lib file I am linking, it either isn't actually linking, or I'm linking the wrong thing.
Does anybody know why I am seeing these linker errors?
Do I need to link a different file? Or perhaps I need to link it in a certain order?
Any help would be appreciated because I can't see what I'm doing wrong.
If any more information is needed, please leave a comment and I will edit the question as soon as I can.
The problem was in the pre-compiled libraries that came with the full download of Assimp 3.0.
I used CMake and Make to compile the Assimp libraries myself and now it is working without any problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With