[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile time errors

From: Paul Pluzhnikov
Subject: Re: Compile time errors
Date: 01 Nov 2004 19:35:40 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) (Vineet) writes:

> I am still getting those undefined references.
> $ g++ -o TDD BufMgr.o TDD.o 
> TDD.o(.text+0x13d2): In function `main':
> : undefined reference to `BufMgr<mru>::BufMgr[in-charge](char*, int, int)'

Well, now you have the opposite problem: you have not provided
enough info for compiler to generate the BufMgr<mru>::BufMgr()

You probably have code like this:

  template <typename T> struct BufMgr { 
         BufMgr(char *, int, int); ... 

but neglected to provide the *body* for BufMgr<T>::BufMgr(char *, ...) 
anywhere where the compiler can see it. Perhaps you've put it into
BufMgr.cpp and expected the compiler to find it there "by magic".

Some compilers, e.g. Sun Workshop, do perform such "magic"; g++ doesn't.

Adding '#include "BufMgr.cpp"' at the end of BufMgr.h is one way
to solve this.

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]