#unresolved external symbol on variable

15 messages · Page 1 of 1 (latest)

rustic spade
#
    static class Loader {
    private:
        static Assimp::Importer importer; // unresolved external symbol
    };

i get this error in a exe that is using this library, I tried including all the libraries that it uses and it still gives the error.

wanton archBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

cunning trout
#

Are you sure you’re linking it correctly? If you’re using visual studio, have you added the .lib file as input?

river lake
#

Also static class thonk

cunning trout
#

Yeah. You have to initialize all static variables in cpp-files. Otherwise the linker cant find an object in the compilation unit which will cause linking error.

rustic spade
rustic spade
#

yeah

#

oh wait nvm i misunderstood what you said

river lake
#

inline static Assimlg::Importer importer = …

rustic spade
#

i thought you meant in a function

#

yeah i did that and it works

#

thanks

wanton archBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity