Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:11:55+00:00 2026-05-29T15:11:55+00:00

I am getting the following linker error: Error 1 error LNK2001: unresolved external symbol

  • 0

I am getting the following linker error:

Error 1 error LNK2001: unresolved external symbol “private: static class std::map,class std::allocator >,struct SDL_Surface *,struct std::less,class std::allocator > >,class std::allocator,class std::allocator > const ,struct SDL_Surface *> > > CSurface::loadedSurfaces” (?loadedSurfaces@CSurface@@0V?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUSDL_Surface@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUSDL_Surface@@@std@@@2@@std@@A) CSurface.obj

The code for the header and cpp file for the CSurface compilation unit is at:

IdeOne.com code post

What is causing this linker error to happen 🙁 its driving me mad.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:11:55+00:00Added an answer on May 29, 2026 at 3:11 pm

    You have declared loadedSurfaces but you have not defined it. You need to add the following to exactly one translation unit to actually declare the variable:

    map<string, SDL_Surface*> CSurface::loadedSurfaces;
    

    As it is now, the loadedSurfaces inside the class definition is like the prototype of the function. When you try to use it, the linker goes and looks for it because it sees the forward declaration, but it never finds the actual definition anywhere. You have to give it a definition and the linker will be satisfied because it knows what actual variable in what actual translation unit everyone is talking about when they use the name loadedSurfaces.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following linker errors: Error 1 error LNK2001: unresolved external symbol public:
I am getting the following error from C++ Builder 2009's linker Unresolved external '__fastcall
Iam getting the following linker error while building an atl com dll which is
I am getting the following linker error: Undefined symbols for architecture i386: _OBJC_CLASS_$_Message, referenced
I'm getting following linker error when I compile my program with VS2008 solution which
Am getting following error message on calling WCF service: The formatter threw an exception
I am getting following error when I am trying to get WebResponse using WebResponse
I am getting following error message when using Doctrine ORM in Codeigniter. ( !
SOLVED in the last answer im getting following error, dunno where and why? cause
Am trying to insert XML into XML Column.. getting following error: . Msg 6819,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.