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. Link Error LNK2019 which makes no sense!

Link Error LNK2019 which makes no sense!

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharphelpquestion
3 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.
  • B Offline
    B Offline
    bneacetp
    wrote on last edited by
    #1

    Here's the deal, I have a test class that I am working on and everything seems to be in order, yet I am struck with a link error for every time I use this class (I am using this class from my main() function in main.cpp). -I have added both the header and source file for the class into my VC++.NET 2003 project. -Within my main.cpp, is my main() function. At the top of this file, I have the header file to my class included. -I have my class header file included at the top of the class's implementation/source file. -The strange thing is when I ALSO include the implementation (.cpp) file at the top of the main.cpp file, it compiles and links with no problems, but I shouldn't have to be including both files. What am I doing wrong? Or has my VC++.NET 2003 just gone crazy? :confused: Any points into the right direction would be greatly appreciated. Happy Programming! WWW::CodeProject::BNEACETP

    Z 1 Reply Last reply
    0
    • B bneacetp

      Here's the deal, I have a test class that I am working on and everything seems to be in order, yet I am struck with a link error for every time I use this class (I am using this class from my main() function in main.cpp). -I have added both the header and source file for the class into my VC++.NET 2003 project. -Within my main.cpp, is my main() function. At the top of this file, I have the header file to my class included. -I have my class header file included at the top of the class's implementation/source file. -The strange thing is when I ALSO include the implementation (.cpp) file at the top of the main.cpp file, it compiles and links with no problems, but I shouldn't have to be including both files. What am I doing wrong? Or has my VC++.NET 2003 just gone crazy? :confused: Any points into the right direction would be greatly appreciated. Happy Programming! WWW::CodeProject::BNEACETP

      Z Offline
      Z Offline
      ZoogieZork
      wrote on last edited by
      #2

      It's tough to figure out this problem without details about your header/implementation and what the link error is. Is your class a template? If so, then the implementation must be defined in the header. - Mike

      B 1 Reply Last reply
      0
      • Z ZoogieZork

        It's tough to figure out this problem without details about your header/implementation and what the link error is. Is your class a template? If so, then the implementation must be defined in the header. - Mike

        B Offline
        B Offline
        bneacetp
        wrote on last edited by
        #3

        Michael Imamura wrote: Is your class a template? Yes it is. Thanks for the info about template class inclusions. I will simply add the implementation code to the header file then. Once again, thanks. :-D Happy Programming! WWW::CodeProject::BNEACETP

        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