From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: inline Date: 29 Aug 2002 08:24:44 GMT Organization: Ericsson Erisoft AB, Sweden Lines: 31 Message-ID: References: NNTP-Posting-Host: lws256.lu.erisoft.se X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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