Mail Archives: djgpp/2002/08/30/06:30:03
Rafal 'Raf256' Maj (rafal AT raf256 DOT com) wrote:
: I have project with several files. When class is in .h (declaration) and in
: .cpp (definition) - then I can not use inline methods.
: i.e:
: --- test.h ---
: class cTest {
: public :
: inline void fun();
: };
: --- test.cpp ---
: inline void cTest::fun() { /* ... */ }
: If I try to use cTest::fun() somwhere then linker reports like :
: Error: main.o: In function `main':
: main.cpp(61) Error: undefined reference to `cMonoBmp::PutPx(int, int,
: bool)'
: Error: collect2: ld returned 1 exit status
: There were some errors
Well, what do you expect? How can the compiler inline anything without
the definition? Put the code into the .h file.
(Note that I don't do C++, though.)
Right,
MartinS
- Raw text -