0
\$\begingroup\$

I am trying to load a 3D model within a DirectX 12 project by means of Assimp, but even when I write only the importer function, I get errors I can not fix. How do I fix this?


Here is my code:

void Model::LoadModel(const std::string& FileName)
{
    Assimp::Importer importer;

    const aiScene* scene = importer.ReadFile("coso.fbx",
        aiProcess_CalcTangentSpace |
        aiProcess_Triangulate |
        aiProcess_GenSmoothNormals |
        aiProcess_SplitLargeMeshes |
        aiProcess_ConvertToLeftHanded |
        aiProcess_SortByPType |
        aiProcess_PreTransformVertices);

    if (scene == NULL)
    {

    }
}

Here are the errors I get:

Error LNK2001 unresolved external symbol "public: struct aiScene const * __cdecl Assimp::Importer::ReadFile(char const *,unsigned int)" (?ReadFile@Importer@Assimp@@QEAAPEBUaiScene@@PEBDI@Z) Model.obj 1

Error LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QEAA@XZ) Model.obj 1

Error LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QEAA@XZ) Model.obj 1

\$\endgroup\$
  • \$\begingroup\$ There you go. this came up as "unanswered" on the review queue. \$\endgroup\$ – Gnemlock Feb 19 '17 at 4:08
  • \$\begingroup\$ @Gnemlock Oh, that's odd... \$\endgroup\$ – Alexandre Vaillancourt Feb 19 '17 at 4:09
1
\$\begingroup\$

You need to add assimp.lib into the list of linked libraries. In Visual Studio's project properties it's in Linker -> Input -> Additional Dependencies. Also add its directory to Additional Library Directories in General.

\$\endgroup\$
  • \$\begingroup\$ Oh you saved me! I forgot to add the .lib file and now it works fine! \$\endgroup\$ – Pino Feb 18 '17 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.