Horrible linker error, how do I fix it? *solved*
Hi, I am using C++ and Direct3D9.
My project was compiling fine, running fine. Then I added a bit of code and went to compile it. It compiled well, with no errors, until it got to the linking stage, where it gives me the error below:
--------------------------
Linking...
LINK : error LNK2020: unresolved token (0A00006C) ?m_lstColorSwapList@CTextureManager@@0V?$list@UTILE@@V?$allocator@UTILE@@@std@@@std@@A
LINK : fatal error LNK1120: 1 unresolved externals
--------------------------
Can someone help me?
[Edited by - utilae on March 14, 2005 2:45:37 PM]
looks like you forgot to link to a library.
that code you added, did it have an static library? .lib or .a? if so, you have to pass is to the linker.
A little bit of Googling seems to imply that most people fixed the problem by linking to msvcrt.lib.
Not sure if that's related to what you're doing, but its worth a shot.
EDIT: Yeah reread the error and Drew is right, and I doubt it has anything to do with the library I mentioned; more just that ur missing a lib in general.
Matt Hughson
Not sure if that's related to what you're doing, but its worth a shot.
EDIT: Yeah reread the error and Drew is right, and I doubt it has anything to do with the library I mentioned; more just that ur missing a lib in general.
Matt Hughson
Quote:Original post by utilae
Hi, I am using C++ and Direct3D9.
My project was compiling fine, running fine. Then I added a bit of code and went to compile it. It compiled well, with no errors, until it got to the linking stage, where it gives me the error below:
--------------------------
Linking...
LINK : error LNK2020: unresolved token (0A00006C) ?m_lstColorSwapList@CTextureManager@@0V?$list@UTILE@@V?$allocator@UTILE@@@std@@@std@@A
LINK : fatal error LNK1120: 1 unresolved externals
--------------------------
Can someone help me?
class CTextureManager
{
// ...
// stuff
// ...
static std::list m_lstColorSwapList;
};
Your class looks pretty much like this right?
So in the file that implements CTextureManager, you need to add:
std::list CTextureManager::m_lstColorSwapList;
and link that in... so that the static member variable is defined somewhere.
Thanks Anonymous Poster.
This fixed it:
list <TILE> CTextureManager::m_lstColorSwapList;
I had forgotten to put the list in my .cpp file (I only had it in the .h). My other lists I remembered, but this one I forgot. It's annoying cause it gave me an error that makes you think my projects corrupt or something.
It's all sweet now anyway, thanks.
This fixed it:
list <TILE> CTextureManager::m_lstColorSwapList;
I had forgotten to put the list in my .cpp file (I only had it in the .h). My other lists I remembered, but this one I forgot. It's annoying cause it gave me an error that makes you think my projects corrupt or something.
It's all sweet now anyway, thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement