# Horrible linker error, how do I fix it? *solved*

This topic is 5060 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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]

##### Share on other sites

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.

##### Share on other sites
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

##### Share on other sites
Quote:
 Original post by utilaeHi, 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@@ALINK : 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.

##### Share on other sites
std::list CTextureManager::m_lstColorSwapList;

Would be even better.

##### Share on other sites
std::list<UTILE> CTextureManager::m_lstColorSwapList;

##### Share on other sites
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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 27
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634101
• Total Posts
3015528
×