Advertisement

Unresolved external symbol (including a library) c++

Started by October 03, 2018 04:54 PM
12 comments, last by EarthBanana 5 years, 11 months ago

Seems to me you changed your project from "multi-threaded" to "multi-threaded DLL" and now you need to change all the DLL binaries you supply to match, otherwise the linker will ignore them.  No one ever said Microsoft Windows was easy on developers (and was telling the truth).

All the binaries you link together in Microsoft Windows have to have the same [debug|multi-threaded|DLL] settings or you will get failure.

Stephen M. Webb
Professional Free Software Developer

Well i didn't recompile that library but:

Adding the line below as well as keeping the dll in the executable folder was the trick. Im not sure why this works now (and before I instead needed it as "additional dependencies") but I guess this is releated to the "multi-threaded DLL" setting I now use.


#pragma comment(lib, "libnoise.lib")

The strange thing is that other libraries (like FMOD for sound) worked fine in the old setting and still works fine, while THIS library required another approach...

Advertisement

Looking at the library it seems unlikely that it was compiled with VS 2017 - and I don't see where it lists whether it was compiled with /MT or /MD.

I would recompile the library if I were you using VS 2017 - if it was linked against a different version of CRT than your linking to (which is highly likely) then it can cause hard to diagnose bugs if it works at all. It's possible that MS 2017 sees that the lib has different CRT linked and doesn't link while pragma comment ignores this and links anyways.

You can use dependency walker to check if you have multiple CRT versions linked in - but almost always when working on windows I have to compile older libraries myself rather than using pre-built libraries.

This topic is closed to new replies.

Advertisement