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\$
2
  • \$\begingroup\$ There you go. this came up as "unanswered" on the review queue. \$\endgroup\$
    – Gnemlock
    Feb 19, 2017 at 4:08
  • \$\begingroup\$ @Gnemlock Oh, that's odd... \$\endgroup\$
    – Vaillancourt
    Feb 19, 2017 at 4:09

1 Answer 1

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\$
1
  • \$\begingroup\$ Oh you saved me! I forgot to add the .lib file and now it works fine! \$\endgroup\$
    – Pino
    Feb 18, 2017 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .