Search code examples
javalinkerunresolved-externalassimp

Can't build JAssimp.dll for Windows x86


So, I'm trying to get into LWJGL, and part of this is loading 3D models, and I thought I'd use JAssimp for this. The readme specifies two steps, building a native component, and a .jar component. The jar was just an ant build, and so it happened without incident. The part that's difficult is the native library. I've been trying to link it, without success. I've included the assimp include directories, included Java's headers, and linked to JAssimp's assimp.lib. However, I still get these errors:

jassimp.obj : error LNK2019: unresolved external symbol _aiImportFile referenced in function _Java_jassimp_Jassimp_aiImportFile@20
jassimp.obj : error LNK2019: unresolved external symbol _aiReleaseImport referenced in function _Java_jassimp_Jassimp_aiImportFile@20
jassimp.obj : error LNK2019: unresolved external symbol _aiGetErrorString referenced in function _Java_jassimp_Jassimp_aiImportFile@20
C:\Users\Kevin\Downloads\assimp-3.1.1-win-binaries\port\jassimp\jassimp-native\src\Release\Jassimp.dll : fatal error LNK1120: 3 unresolved externals

Googling around leads to mostly the same question, but with no answers, and one guy on facepunch that apparently found a solution, but pulled an https://xkcd.com/979/ and never mentioned how. Obviously, I've missed linking to some library, but I'm not sure what else to link to, Assimp only provided me one, and I'm not sure what else I need. Am I installing it wrong?


Solution

  • For anyone else who stumbles across this with the same problem, the answer is to do it the old-fashioned way and compile the C++ Assimp yourself. This will give you, (among other things) a new assimp.lib. Link with this instead of the one provided, and the error will go away.