Linker Errors with Templates

This is a discussion on Linker Errors with Templates within the C++ Programming forums, part of the General Programming Boards category; Does it work if you put all the code in the header? You said no, but then you said that ...

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Does it work if you put all the code in the header? You said no, but then you said that it does work if you #include the cpp in the main source file. There shouldn't be another cpp file to include if you are trying it by putting all the template code into the header.

    All the code that used to be in the source file should now be at the bottom of the header. Your header should have one set of include guards encompassing everything. That header should be included in your main source file. If you are doing that, it should work.

  2. #17
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    What's not working with the private members? You haven't used any in the code you've posted, so I assume you're talking about something outside of that.

    -yawn-
    So sorry to bore you
    There is a difference between tedious and difficult.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Templates + ref to pointer + linker error.
    By Sparrowhawk in forum C++ Programming
    Replies: 8
    Last Post: 05-18-2009, 04:06 PM
  2. Linker errors on Winsock2 functions
    By ShadowMetis in forum C++ Programming
    Replies: 2
    Last Post: 11-20-2004, 10:19 PM
  3. help, linker errors when adding library file to project
    By ngcfan525 in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2003, 01:27 PM
  4. MSVis-Studio C++ libraries and linker errors
    By kellydj in forum Windows Programming
    Replies: 10
    Last Post: 03-12-2002, 01:03 PM
  5. Linker errors with simple static library
    By Dang in forum Windows Programming
    Replies: 5
    Last Post: 09-08-2001, 09:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21