0

sorry to bother you.

I know this is a commonly asked question and this is probably annoying to get again but I'm just completely stuck and not sure what I'm doing wrong.

I'm following learnopengl.com and trying to add assimp to my CLion project.

I created a new project quickly just so I know nothing is interfering.

I have a folder on my C drive where I placed in assimp library.

I downloaded it by following https://github.com/assimp/assimp/blob/master/Build.md with git and doing

cd assimp cmake CMakeLists.txt 

but changing the BUILD_SHARED_LIBS to OFF

Then I build the library with visual studio 2022 Using "Release x64" and the "Visual Studio 2022 (v143)" toolset

I link to the library with CMake as below. I don't get an error message so I know that CMake finds the library. I also have the location to the library setup in the PATH.

cmake_minimum_required(VERSION 3.22) project(lemmefixbroken) set(CMAKE_CXX_STANDARD 20) set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") add_executable(lemmefixbroken main.cpp) # assimp include_directories("C:/dev/libraries/assimp/include") find_library(ASSIMP_LOCATION NAMES "assimp-vc143-mt" REQUIRED) message(${ASSIMP_LOCATION}) target_link_libraries(${PROJECT_NAME} "${ASSIMP_LOCATION}") 

My compiler settings are as below: (Using the compiler located in Visual Studio 2022 and using the architecture amd64) I've tried all the different architectures but none work. The message returns "C:/dev/libraries/assimp/lib/Release/assimp-vc143-mt.lib" which is where its located

My code is:

#include <iostream> #include "assimp/Importer.hpp" int main() { std::cout << "Hello, World!" << std::endl; Assimp::Importer import; return 0; } 

When I build the code I get this error:

"C:\Program Files\JetBrains\CLion 2022.1.1\bin\cmake\win\bin\cmake.exe" --build C:\Users\charl\CLionProjects\lemmefixbroken\cmake-build-release --target all -j 9 [1/2] Building CXX object CMakeFiles\lemmefixbroken.dir\main.cpp.obj [2/2] Linking CXX executable lemmefixbroken.exe FAILED: lemmefixbroken.exe cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2022.1.1\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\lemmefixbroken.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo CMakeFiles\lemmefixbroken.dir\main.cpp.obj /out:lemmefixbroken.exe /implib:lemmefixbroken.lib /pdb:lemmefixbroken.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console C:\dev\libraries\assimp\lib\Release\assimp-vc143-mt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." LINK: command "C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo CMakeFiles\lemmefixbroken.dir\main.cpp.obj /out:lemmefixbroken.exe /implib:lemmefixbroken.lib /pdb:lemmefixbroken.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console C:\dev\libraries\assimp\lib\Release\assimp-vc143-mt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:lemmefixbroken.exe.manifest" failed (exit code 1120) with the following output: assimp-vc143-mt.lib(AssbinLoader.obj) : error LNK2019: unresolved external symbol uncompress referenced in function "public: virtual void __cdecl Assimp::AssbinImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@AssbinImporter@Assimp@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAUaiScene@@PEAVIOSystem@2@@Z) assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflate referenced in function "public: unsigned __int64 __cdecl Assimp::Compression::decompress(void const *,unsigned __int64,class std::vector<char,class std::allocator<char> > &)" (?decompress@Compression@Assimp@@QEAA_KPEBX_KAEAV?$vector@DV?$allocator@D@std@@@std@@@Z) assimp-vc143-mt.lib(unzip.obj) : error LNK2001: unresolved external symbol inflate assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflateEnd referenced in function "public: bool __cdecl Assimp::Compression::close(void)" (?close@Compression@Assimp@@QEAA_NXZ) assimp-vc143-mt.lib(unzip.obj) : error LNK2001: unresolved external symbol inflateEnd assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflateSetDictionary referenced in function "public: unsigned __int64 __cdecl Assimp::Compression::decompressBlock(void const *,unsigned __int64,char *,unsigned __int64)" (?decompressBlock@Compression@Assimp@@QEAA_KPEBX_KPEAD1@Z) assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflateReset referenced in function "public: unsigned __int64 __cdecl Assimp::Compression::decompressBlock(void const *,unsigned __int64,char *,unsigned __int64)" (?decompressBlock@Compression@Assimp@@QEAA_KPEBX_KPEAD1@Z) assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflateInit_ referenced in function "public: bool __cdecl Assimp::Compression::open(enum Assimp::Compression::Format,enum Assimp::Compression::FlushMode,int)" (?open@Compression@Assimp@@QEAA_NW4Format@12@W4FlushMode@12@H@Z) assimp-vc143-mt.lib(Compression.obj) : error LNK2019: unresolved external symbol inflateInit2_ referenced in function "public: bool __cdecl Assimp::Compression::open(enum Assimp::Compression::Format,enum Assimp::Compression::FlushMode,int)" (?open@Compression@Assimp@@QEAA_NW4Format@12@W4FlushMode@12@H@Z) assimp-vc143-mt.lib(unzip.obj) : error LNK2001: unresolved external symbol inflateInit2_ assimp-vc143-mt.lib(unzip.obj) : error LNK2019: unresolved external symbol crc32 referenced in function unzReadCurrentFile assimp-vc143-mt.lib(unzip.obj) : error LNK2019: unresolved external symbol get_crc_table referenced in function unzOpenCurrentFile3 lemmefixbroken.exe : fatal error LNK1120: 9 unresolved externals ninja: build stopped: subcommand failed. 

I've tried compiling the library more times than I would like to count. I've tried using the 2019 compiler and nothing. I still get all the same errors. I have no clue what I'm doing wrong but hopefully someone here will know. I've also tried using shared libraries with no success. I've updated Visual Studio 2022 and restarted my computer then compiling again and still nothing changes.

4
  • What's the value of ASSIMP_LOCACTION after that find_library call? Unless there's more to the CMake config I highly doubt that knows where to look for your library. Commented Aug 21, 2022 at 5:32
  • it returns "C:/dev/libraries/assimp/lib/Release/assimp-vc143-mt.lib" and thats where the fil is located. Commented Aug 21, 2022 at 5:35
  • Oh, I see, yeah, it's there in the linker command. Are you linking against assimp's dependencies as well (i.e. zlib, unzip, etc.)? I don't see those listed on the command line, so I assume find_assimp doesn't add those as public dependencies. You'll need to target_link_libraies them as well. Commented Aug 21, 2022 at 5:41
  • haha. gonna cry. thank you. I thought cause it built its own zlib it already linked against it. It didn't. Just had to link against its zlib library and now everything is all good. Thank you so much. Commented Aug 21, 2022 at 5:56

2 Answers 2

1

Those are all zlib symbols that are missing, which means you didn't link against that. Asset-Importer lists several dependencies:

  • zlib
  • zip-lib
  • unzip
  • pugi-xml
  • rapijson
  • clipper
  • draco
  • gtest
  • stb_image
  • utf8cpp
  • poly2tri
  • openddlparser

Since Findassimp.cmake uses an old path-based interface instead of the newer style of defining virtual targets that can have PUBLIC dependencies, you will need to link against those yourself. They're all in the library's source tree, but having never used the library I don't know if they get built as part of its build scripts of if you would need to do that yourself.

Sign up to request clarification or add additional context in comments.

Comments

0

As you can see in the error messages, what failed is the linking process, not the compiling process.

I think your linker could not find the assimp library's '.lib' files.

Did you specify the path to the assimp library's '.lib' files in the project setting?

You could do this in 'VC++ Directories' or 'Linker/Input', though I'm not sure since I'm not using my computer at the moment.

1 Comment

I'm using CMake. Added more details and I'm fairly certain it finds it. Returns the correct location.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.