assimp / assimp

The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.
https://www.assimp.org
Other
10.74k stars 2.89k forks source link

linker error on macos #4588

Open flowingss opened 2 years ago

flowingss commented 2 years ago

So when I am compiling on VScode, I get the following errors:

Steps to reproduce the behavior: Undefined symbols for architecture x86_64: "Assimp::Importer::ReadFile(char const*, unsigned int)", referenced from: Assimp::Importer::ReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in main-99c4ca.o "Assimp::Importer::Importer()", referenced from: Model::loadModel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-99c4ca.o "Assimp::Importer::~Importer()", referenced from: Model::loadModel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-99c4ca.o "Assimp::Importer::GetErrorString() const", referenced from: Model::loadModel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-99c4ca.o "_aiGetMaterialTexture", referenced from: aiMaterial::GetTexture(aiTextureType, unsigned int, aiString*, aiTextureMapping*, unsigned int*, float*, aiTextureOp*, aiTextureMapMode*) const in main-99c4ca.o "_aiGetMaterialTextureCount", referenced from: aiMaterial::GetTextureCount(aiTextureType) const in main-99c4ca.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using GLFW and Assimp to draw a 3d model to the screen but I am getting a linking error

Here is my source code: Main.CPP: https://snipplr.com/view/345610/maincpp-for-github-error Model.h: https://snipplr.com/view/345611/modelh-for-github-error Mesh.h: https://snipplr.com/view/345612/meshh-for-github-error Shader.h: https://snipplr.com/view/345613/shaderh-github-error shader_m.h: https://snipplr.com/view/345614/shadermh-github-error filesystem.h: https://snipplr.com/view/345615/filesystemh-error-on-github camera.h: https://snipplr.com/view/345616/camerah-for-github-error (if you want any other source code just ask me and it's probably not in most of these files just adding them for accessibility.)

kimkulling commented 2 years ago

Which version of assimp do you use?

flowingss commented 2 years ago

Which version of assimp do you use?

I used homebrew to install it so it is 5.2.4

kimkulling commented 2 years ago

CAn you please show me your cmake file or your makefile?

flowingss commented 2 years ago

I was able to fix it by adding the dylib to the compiler arguments as a library, thanks very much.

kimkulling commented 1 year ago

Thanks for the update, I will close the issue.