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 3966616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:37:20+00:00 2026-05-20T03:37:20+00:00

1>main.obj : error LNK2019: unresolved external symbol public: __thiscall MyList<class Event>::~MyList<class Event>(void) (??1?$MyList@VEvent@@@@QAE@XZ) referenced

  • 0
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall MyList<class Event>::~MyList<class Event>(void)" (??1?$MyList@VEvent@@@@QAE@XZ) referenced in function _main

Any idea what could be wrong? I had a working class before and then i tried to template it and i get this error above. Any idea ? I’m a little lost.

And in main i use this :

MyList<Event> eventManager;
  • 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-20T03:37:20+00:00Added an answer on May 20, 2026 at 3:37 am

    Templates play oddly with C++’s compilation model because they aren’t executable code – they’re templates for executable code. Consequently, the standard model of partitioning a class into a .h/.cpp pair does not work correctly for templates.

    The reason that you typically break apart a class into a .h file with the interface and the .cpp file with the implementation is that normally, .cpp files can be compiled separately while referencing code defined in other .cpp files because the linker will patch together all of the references after the files are compiled. Since all the .cpp compile down to object files containing executable code, everything will work out correctly.

    With templates, however, this system breaks down. If you define a template class and then put all the implementations of its member functions into a .cpp file, then when the compiler compiles that file it won’t find any code – just templates for code, and so it won’t generate any object code for the template methods. Consequently, at link-time, you’ll get errors for every member function you tried to call on the template class because there’s no code available.

    I don’t know for sure if this is what’s causing your particular error, but from what you’re describing it looks like this is the case, especially since you changed a non-template class (probably split across a .h/.cpp pair) into a template class.

    To fix this problem, the traditional C++ solution is just to have a .h file for the template without an accompanying source file. You can do this by just moving all of the code in the source file into the header. I like to put a line in the header marking where the interface stops and implementation begins, often something like

    /* * * * * Implementation Below This Point * * * * */
    

    or

    /* * * * * Here be Dragons * * * * */
    

    To make the point a bit clearer.

    Hope this helps!

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

Sidebar

Related Questions

Linking... Directory.obj : error LNK2019: unresolved external symbol public: void __thiscall indexList<class entry,100>::read(class std::basic_istream<char,struct
I'm getting this error when trying to compile: *1>main-light.obj : error LNK2019: unresolved external
It doesn't compile in Visual Studio, it says 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external
Does anyone know what this means? 1> Generating Code... 1>BlankWindowDXbaseImpl.obj : error LNK2019: unresolved
Why main must be declared as if it has external linkage? Why it should
I am trying to call another function, foo(), in the Raw class from main.cpp
I'm getting linker errors when using Classes that reference other classes in them. 1>main.obj
I have a base class MyBase that contains a pure virtual function: void PrintStartMessage()
getting this 1>main_display.obj : error LNK2005: struct ALLEGRO_DISPLAY * main_display (?main_display@@3PAUALLEGRO_DISPLAY@@A) already defined in
I am trying to build a BehaviourTree data structure. The main class is BTNode,

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.