From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: error whe compile with djgpp Date: Sun, 30 Nov 1997 16:10:15 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 38 Message-ID: <34818FE7.782C@cs.com> References: <34803869 DOT 5A39 AT videotron DOT ca> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp202.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Rivet-Sabourin wrote: > > Why when compile simple progam like: > [snip] > c:\djgpp/tmp\ccdaaaaa(.text+0x16):test.cc: undefined to 'cout' > c:\djgpp/tmp\ccdaaaaa(.text+0x16):test.cc: undefined to > 'ostream::operator << (char const*)' Because you didn't follow the instructions. To properly link C++ code, you must add the C++ libraries to the command line: gcc -o myprog.exe myprog.cpp -lgpp You can also use 'gxx' instead of 'gcc', which adds the libraries automatically. BTW... > void main() > { > cout << "Allo"; > } void main() is illegal C/C++. main() must always return an integer. int main( void ) { cout << "Allo"; return 0; } -- --------------------------------------------------------------------- | John M. Aldrich | "A committee is a life form with six | | aka Fighteer I | or more legs and no brain." | | mailto:fighteer AT cs DOT com | | | http://www.cs.com/fighteer | - Lazarus Long | --------------------------------------------------------------------- mmittee is a life form with six | | aka Fighteer I | or more legs and no brain." | | mailto:fighteer AT cs DOT com | | | http://www.cs.com/fighteer | - Lazarus Long | ---------------------------------------------------------------------