Jump to content
  • Advertisement
Sign in to follow this  
utilae

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

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
std::list CTextureManager::m_lstColorSwapList;

Would be even better.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
std::list<UTILE> CTextureManager::m_lstColorSwapList;

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!