The Most Annoying Linker Error: Unresolved External Symbol

closed account (zb0S216C)
As in the title, I'm receiving unresolved external symbol linker errors. I've tried to fix these errors but failed to do so.

Here's what I've done so far:
1) Link the library as an additional dependency.
2) Added the library's headers in the Include Directories.
3) Set the Additional Library Directories to the location of my library.
4) Include the headers for the library.
5) Set the Library Directories to the location of my library.

I've done all of these and Visual C++ still cannot find my code definitions.
I've even tried using #pragma comment( lib, <Library_Name> ).

Any suggestions?

Additional notes:
Microsoft say that encasing the library name in a pragma directive will cause a linker error. This proved correct as I received the linker error.
Last edited on
This is lounge (you can move the thread, I believe)

I don't see why #pragma would fail..
Anyway, you should put it in Properties->Linker->Input->Additional dependencies, if you haven't.
closed account (zb0S216C)
I set the Additional Dependencies as you said, Hamsterman, but the linker errors remain.
Examine the libraries and check that they do actually contain the functions you're trying to link to. Under *.nix I'd use the nm command; presumably there's an equivalent under Win.
Perhaps your linking to the libs in the wrong order? (provided that there are more than 1...)
closed account (zb0S216C)
It's just the one library. I followed the tutorial in the link below by Microsoft, but it still gave me the errors.

References:
http://msdn.microsoft.com/en-us/library/ms235627(v=vs.80).aspx
Are you only having problems with a specific library or are you unable to link to any?
Also, did you try compiling from code::blocks (or anything else) ?
closed account (zb0S216C)
It was the one specific library. I solved the errors anyway.

It appears as though template structures were the culprit. The template structures' members were defined in separate source files. This is what the linker errors were referring to. So I placed the method definitions inside the header where the template structures were defined.

And now, the link was successful.

If anybody else has this problem in the future, I recommend reading the above link( in my previous post ). The link teach you how to reference projects so they link successfully.
Topic archived. No new replies allowed.