[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compile time errors
From: |
Vineet |
Subject: |
Re: Compile time errors |
Date: |
4 Nov 2004 09:46:43 -0800 |
Thanks, Paul. That worked!!
Cheers,
Vineet
Paul Pluzhnikov <ppluzhnikov-nsp@charter.net> wrote in message
news:<m3mzy0apo3.fsf@salmon.parasoft.com>...
> vineetc@gmail.com (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()
> instantiation.
>
> 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.
>
> Cheers,