• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
using C++ templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using C++ templates


  • Subject: using C++ templates
  • From: Piotr Rychlik <email@hidden>
  • Date: Thu, 18 Feb 2010 00:38:59 +0100

Hi,

I have a problem with compiling the following code written in C++ using XCode:

Heder file: List.h

template<class T>
class List
{
  public:
    List();
    ~List();
........
};

Implementation file: List.cpp

template<class T>
List<T>::List()
{
........
}

template<class T>
List<T>::~List()
{
........
}

File: main.cpp

#include "List.h"

int main (int argc, char * const argv[]) {
  List<int> l;
  return 0;
}

I receive the following link error:

Undefined symbols:
  "List<int>::List()", referenced from:
      _main in main.o
  "List<int>::~List()", referenced from:
      _main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Is there something wrong with the code?

Regards,
Piotr Rychlik

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: using C++ templates
      • From: "Glenn L. Austin" <email@hidden>
  • Prev by Date: gprof
  • Next by Date: Re: using C++ templates
  • Previous by thread: gprof
  • Next by thread: Re: using C++ templates
  • Index(es):
    • Date
    • Thread