This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Q) link error of template class


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]