Article View: comp.sys.mac.programmer.help
Article #1Symantec C++ v7->7.04 templates ?
From: Jeremy Pye
Date: Fri, 11 Aug 1995 12:14
Date: Fri, 11 Aug 1995 12:14
34 lines
1110 bytes
1110 bytes
I have just tried to run the following piece of code in
symantec C++ v7.04. It runs ok under v7.0.
Why is it that this piece of code (using templates) doesn't
link ? Please explain. [Our manual is temporarily missing]
#include <iostream.h>
template <class T>
class A {
public:
T data;
public:
A(T init) : data(init) {}
void print(void);
};
template <class T>
void A<T>::print(void)
{
cout << "Hello " << data << endl;
}
void main()
{
A<int> a(10);
a.print();
}
Link Errors:
undefined: A<int>::print(void)
Jeremy Pye <cjp@sys.uea.ac.uk>
Technical Details
Message-ID:
<40fhim$so6@cpca3.uea.ac.uk>Path:
arc1-ca.pugleaf.net!cpca3.uea.ac.uk!newsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cpca3.uea.ac.uk!news From: Jeremy Pye <cjp@sys.uea.ac.uk> Newsgroups: comp.sys.mac.programmer.help,comp.lang.c++ Subject: Symantec C++ v7->7.04 templates ? Date: 11 Aug 1995 12:14:14 GMT Organization: School of Information Systems, UEA, Norwich Message-ID: <40fhim$so6@cpca3.uea.ac.uk> NNTP-Posting-Host: case1.sys.uea.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (Macintosh; I; 68K) X-URL: news:comp.sys.mac.programmer.help