This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Q) link error of template class
- To: gcc at gcc dot gnu dot org
- Subject: Re: Q) link error of template class
- From: Gordon Sadler <gbsadler1 at lcisp dot com>
- Date: Tue, 8 May 2001 10:34:52 -0500
On Tue, May 08, 2001 at 11:03:52PM +0900, ?????? wrote:
> Hi,
>
> I compile the source code with -frepo option as manual writes.
> But I have link errors as follows
>
>
>
> BClass<STRT>::func1(void) testout.o
> BClass<STRT>::func1(void) testout.o
> ld : fatal : Symbol referencing errors. No out written to testout
> collect2: ld returned 1 exit status
> *** Error code 1
> make: Fatal error: Command failed for target 'testout'
>
>
>
>
> Source code is as follows
> This code is compose of three files(AClass.cpp, BClass.cpp, Main.cpp)
>
>
>
> typedef struct {
> int i;
> } STRT;
>
> template<class T>
> class AClass {
> public :
> };
>
> template<class T>
> class BClass : public AClass<T>
> {
> public :
> void func1(void);
> void func2(void);
> };
>
> int main(int argc, char **argv)
> {
> BClass<STRT> *a = new BClass<STRT>
> }
>
>
> Let me know how to solve the problem.
>
Other than the fact you need a semicolon after ...new BClass<STRT>
This compiles fine here, 2.95.4(20010506) and 3.0(20010426).
Gordon Sadler