From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: undefined references Date: Wed, 12 Nov 1997 09:16:50 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 34 Message-ID: <34697402.241@cs.com> References: <34654D36 DOT 7518 AT cs DOT huji DOT ac DOT il> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp218.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 Ofer Corshid wrote: > > #include > > void main() > { > cout << "test"; > } > > When I enter this command: > gcc myfile.cc -o myfile.exe > > I get this messages: > undefined reference to 'cout' > undefined reference to 'ostream::operator<<(char const *)' You forgot to link in the C++ libraries, as instructed in 'readme.1st'. If you didn't read that file, please do so. You can link the libraries either by adding '-lgcc' (or -lstdcx or -liostr) to the end of your command line, or by substituting 'gxx' for 'gcc'. P.S.: void main() is illegal C/C++. main() must always return an integer. If you add '-Wall' to your command line, it will catch lots of pesky little errors that you probably wouldn't find otherwise. hth -- --------------------------------------------------------------------- | John M. Aldrich | "History does not record anywhere at | | aka Fighteer I | any time a religion that has any | | mailto:fighteer AT cs DOT com | rational basis." | | http://www.cs.com/fighteer | - Lazarus Long | ---------------------------------------------------------------------