Sign in to follow this  
Garra

Assimp Unresolved Externals

Recommended Posts

I'm working on a model loader with the Assimp library. I included the .lib and include files in my project properties->VC++ Directories and everything seemed to be fine. I started writing some code and when I got to the point that I could actually run it I ran into the following unresolved externals. Basically any time I try to create the actual importer it throws the errors. For example with only the following code and some Assimp variable types in the code (such as aiScene) I get the externals. When the importer is commented out they go away.

[code]
Assimp::Importer importer;
[/code]

[code]
1>MeshLoader.obj : error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QAE@XZ) referenced in function "public: struct ID3DX10Mesh * __thiscall MeshLoader::ImportMesh(struct ID3D10Device *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?ImportMesh@MeshLoader@@QAEPAUID3DX10Mesh@@PAUID3D10Device@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>MeshLoader.obj : error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QAE@XZ) referenced in function "public: struct ID3DX10Mesh * __thiscall MeshLoader::ImportMesh(struct ID3D10Device *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?ImportMesh@MeshLoader@@QAEPAUID3DX10Mesh@@PAUID3D10Device@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)[/code]

Below are the full steps that I've done, I'm pretty sure the library is added correctly so I'm not sure what the problem is.
1. I Built the Assimp library from scratch in Visual Studio 10. I just added all the included and source files to a project. Then went into project properties and changed the configuration type to static library
2. Built the project, everything went fine.
3. Made a folder inside my project directory called externals, added an include and lib folder, then copied the includes and lib into it.
4. Went to project properties->VC++ Directories->include directories and added externals\ASSIMP\include
5. Went to project properties->VC++ Directories->library directories and added externals\ASSIMP\lib
6.Started coding the loader, visual studio seemed to be set up properly, but when I ran the app I got those externals.

A few things I've tried - I'm using Windows 7 64-bit.
1. Rebuilt Assimp
2. Rebuild Assimp with \MACHINE:X64 in the librarian command line. (the result was it saying something like it found a x86 processor and x64 doesn't match). I can get the exact message if needed. I started playing with this because I was getting a warning that it wasn't defined. I ended up just sticking \MACHINE:X86 in the command line and the warning went away.
3. I've also tried some pre-built libs that came with ASSIMP but they were compiled in visual studio 2008 and produced the same results.
4. Commenting out everything in the code other than Assimp::Importer importer which produced unresolved externals.

I'm kinda confused on what to do now, anyone have some ideas?

Share this post


Link to post
Share on other sites
Did you actually add the .lib file to your project? This can be done in a couple ways. The one I usually use is going to the project properties and under Linker/Input, add the .lib file to the Additional Dependencies line.

Share this post


Link to post
Share on other sites
[quote name='Garra' timestamp='1318774658' post='4873120']
I'm working on a model loader with the Assimp library. I included the .lib and include files in my project properties->VC++ Directories and everything seemed to be fine. I started writing some code and when I got to the point that I could actually run it I ran into the following unresolved externals. Basically any time I try to create the actual importer it throws the errors. For example with only the following code and some Assimp variable types in the code (such as aiScene) I get the externals. When the importer is commented out they go away.

[code]
Assimp::Importer importer;
[/code]

[code]
1>MeshLoader.obj : error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QAE@XZ) referenced in function "public: struct ID3DX10Mesh * __thiscall MeshLoader::ImportMesh(struct ID3D10Device *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?ImportMesh@MeshLoader@@QAEPAUID3DX10Mesh@@PAUID3D10Device@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>MeshLoader.obj : error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QAE@XZ) referenced in function "public: struct ID3DX10Mesh * __thiscall MeshLoader::ImportMesh(struct ID3D10Device *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?ImportMesh@MeshLoader@@QAEPAUID3DX10Mesh@@PAUID3D10Device@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)[/code]

Below are the full steps that I've done, I'm pretty sure the library is added correctly so I'm not sure what the problem is.
1. I Built the Assimp library from scratch in Visual Studio 10. I just added all the included and source files to a project. Then went into project properties and changed the configuration type to static library
2. Built the project, everything went fine.
3. Made a folder inside my project directory called externals, added an include and lib folder, then copied the includes and lib into it.
4. Went to project properties->VC++ Directories->include directories and added externals\ASSIMP\include
5. Went to project properties->VC++ Directories->library directories and added externals\ASSIMP\lib
6.Started coding the loader, visual studio seemed to be set up properly, but when I ran the app I got those externals.

A few things I've tried - I'm using Windows 7 64-bit.
1. Rebuilt Assimp
2. Rebuild Assimp with \MACHINE:X64 in the librarian command line. (the result was it saying something like it found a x86 processor and x64 doesn't match). I can get the exact message if needed. I started playing with this because I was getting a warning that it wasn't defined. I ended up just sticking \MACHINE:X86 in the command line and the warning went away.
3. I've also tried some pre-built libs that came with ASSIMP but they were compiled in visual studio 2008 and produced the same results.
4. Commenting out everything in the code other than Assimp::Importer importer which produced unresolved externals.

I'm kinda confused on what to do now, anyone have some ideas?
[/quote]

Just to confirm, have you actually linked to the static lib that you have built, because I don't see that in your steps :)

Share this post


Link to post
Share on other sites
Have you added assimp.lib to the project's Additional Dependencies (Project Settings>Linker>Input)?

Adding ASSIMP\Lib to directories only tells VS where it can find external libraries, not which libraries to look for.

Share this post


Link to post
Share on other sites
It was indeed not linked, however once I linked it a lot more unresolved externals decided to show up

[code]
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflateEnd
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflate referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflate
1>assimp.lib(BlenderLoader.obj) : error LNK2019: unresolved external symbol _inflateInit2_ referenced in function "protected: virtual void __thiscall Assimp::BlenderImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@BlenderImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2001: unresolved external symbol _inflateInit2_
1>assimp.lib(IRRLoader.obj) : error LNK2019: unresolved external symbol "class irr::io::IIrrXMLReader<char,class irr::io::IXMLBase> * __cdecl irr::io::createIrrXMLReader(class irr::io::IFileReadCallBack *)" (?createIrrXMLReader@io@irr@@YAPAV?$IIrrXMLReader@DVIXMLBase@io@irr@@@12@PAVIFileReadCallBack@12@@Z) referenced in function "protected: virtual void __thiscall Assimp::IRRImporter::InternReadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct aiScene *,class Assimp::IOSystem *)" (?InternReadFile@IRRImporter@Assimp@@MAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUaiScene@@PAVIOSystem@2@@Z)
1>assimp.lib(IRRMeshLoader.obj) : error LNK2001: unresolved external symbol "class irr::io::IIrrXMLReader<char,class irr::io::IXMLBase> * __cdecl irr::io::createIrrXMLReader(class irr::io::IFileReadCallBack *)" (?createIrrXMLReader@io@irr@@YAPAV?$IIrrXMLReader@DVIXMLBase@io@irr@@@12@PAVIFileReadCallBack@12@@Z)
1>assimp.lib(OgreImporter.obj) : error LNK2001: unresolved external symbol "class irr::io::IIrrXMLReader<char,class irr::io::IXMLBase> * __cdecl irr::io::createIrrXMLReader(class irr::io::IFileReadCallBack *)" (?createIrrXMLReader@io@irr@@YAPAV?$IIrrXMLReader@DVIXMLBase@io@irr@@@12@PAVIFileReadCallBack@12@@Z)
1>assimp.lib(ColladaParser.obj) : error LNK2001: unresolved external symbol "class irr::io::IIrrXMLReader<char,class irr::io::IXMLBase> * __cdecl irr::io::createIrrXMLReader(class irr::io::IFileReadCallBack *)" (?createIrrXMLReader@io@irr@@YAPAV?$IIrrXMLReader@DVIXMLBase@io@irr@@@12@PAVIFileReadCallBack@12@@Z)
1>assimp.lib(BaseImporter.obj) : error LNK2019: unresolved external symbol _ConvertUTF16toUTF8 referenced in function "public: static void __cdecl Assimp::BaseImporter::ConvertToUTF8(class std::vector<char,class std::allocator<char> > &)" (?ConvertToUTF8@BaseImporter@Assimp@@SAXAAV?$vector@DV?$allocator@D@std@@@std@@@Z)
1>assimp.lib(BaseImporter.obj) : error LNK2019: unresolved external symbol _ConvertUTF32toUTF8 referenced in function "public: static void __cdecl Assimp::BaseImporter::ConvertToUTF8(class std::vector<char,class std::allocator<char> > &)" (?ConvertToUTF8@BaseImporter@Assimp@@SAXAAV?$vector@DV?$allocator@D@std@@@std@@@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzOpen referenced in function "public: __thiscall Assimp::Q3BSP::Q3BSPZipArchive::Q3BSPZipArchive(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Q3BSPZipArchive@Q3BSP@Assimp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzClose referenced in function "public: virtual __thiscall Assimp::Q3BSP::Q3BSPZipArchive::~Q3BSPZipArchive(void)" (??1Q3BSPZipArchive@Q3BSP@Assimp@@UAE@XZ)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzCloseCurrentFile referenced in function "public: virtual unsigned int __thiscall Assimp::Q3BSP::ZipFile::Read(void *,unsigned int,unsigned int)" (?Read@ZipFile@Q3BSP@Assimp@@UAEIPAXII@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzReadCurrentFile referenced in function "public: virtual unsigned int __thiscall Assimp::Q3BSP::ZipFile::Read(void *,unsigned int,unsigned int)" (?Read@ZipFile@Q3BSP@Assimp@@UAEIPAXII@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzOpenCurrentFile referenced in function "public: virtual unsigned int __thiscall Assimp::Q3BSP::ZipFile::Read(void *,unsigned int,unsigned int)" (?Read@ZipFile@Q3BSP@Assimp@@UAEIPAXII@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzGetCurrentFileInfo referenced in function "public: virtual unsigned int __thiscall Assimp::Q3BSP::ZipFile::Read(void *,unsigned int,unsigned int)" (?Read@ZipFile@Q3BSP@Assimp@@UAEIPAXII@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzLocateFile referenced in function "public: virtual unsigned int __thiscall Assimp::Q3BSP::ZipFile::Read(void *,unsigned int,unsigned int)" (?Read@ZipFile@Q3BSP@Assimp@@UAEIPAXII@Z)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzGoToNextFile referenced in function "private: bool __thiscall Assimp::Q3BSP::Q3BSPZipArchive::mapArchive(void)" (?mapArchive@Q3BSPZipArchive@Q3BSP@Assimp@@AAE_NXZ)
1>assimp.lib(Q3BSPZipArchive.obj) : error LNK2019: unresolved external symbol _unzGoToFirstFile referenced in function "private: bool __thiscall Assimp::Q3BSP::Q3BSPZipArchive::mapArchive(void)" (?mapArchive@Q3BSPZipArchive@Q3BSP@Assimp@@AAE_NXZ)
1>assimp.lib(XFileParser.obj) : error LNK2019: unresolved external symbol _inflateSetDictionary referenced in function "public: __thiscall Assimp::XFileParser::XFileParser(class std::vector<char,class std::allocator<char> > const &)" (??0XFileParser@Assimp@@QAE@ABV?$vector@DV?$allocator@D@std@@@std@@@Z)
1>assimp.lib(XFileParser.obj) : error LNK2019: unresolved external symbol _inflateReset referenced in function "public: __thiscall Assimp::XFileParser::XFileParser(class std::vector<char,class std::allocator<char> > const &)" (??0XFileParser@Assimp@@QAE@ABV?$vector@DV?$allocator@D@std@@@std@@@Z)
[/code]


EDIT: It seems to be something to do with how I'm building the ASSIMP library. The program now runs with the pre-built assimp.lib compiled in VS2008, but I'm not sure if it's ok to use a .lib compiled with another compiler. I don't have a lot of experience with compiling libs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this