Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. LNK2019 Error

LNK2019 Error

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    james_dixon_2008
    wrote on last edited by
    #1

    Hi Developers, I am writing a template class. In template class - class is declared and defined in the same header file..i.e. there is no need to include .cpp file. So when i first declare the class and then define it within the same header file and include it in a test (Main) file. Then i get this many LNK2019 error Whereas if i directly define the class without first declaring it then it works perfectly fine. or if i remove the test (main) file then also i do not get any LNK2019 error. What could be the problem here ? Any help would be greatly appreciated. Ta James

    B 1 Reply Last reply
    0
    • J james_dixon_2008

      Hi Developers, I am writing a template class. In template class - class is declared and defined in the same header file..i.e. there is no need to include .cpp file. So when i first declare the class and then define it within the same header file and include it in a test (Main) file. Then i get this many LNK2019 error Whereas if i directly define the class without first declaring it then it works perfectly fine. or if i remove the test (main) file then also i do not get any LNK2019 error. What could be the problem here ? Any help would be greatly appreciated. Ta James

      B Offline
      B Offline
      BhawnaA
      wrote on last edited by
      #2

      I tried the same thing but didn't got any error. Thus, if you can please share the code snippet, we may provide some inputs.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups