From: "Tony O'Bryan" Newsgroups: comp.os.msdos.djgpp Subject: Re: undefined references Date: Tue, 11 Nov 1997 18:16:21 -0600 Organization: Southwest Missouri State University Lines: 30 Message-ID: <3468F555.4F97@nic.smsu.edu> References: <34654D36 DOT 7518 AT cs DOT huji DOT ac DOT il> Reply-To: aho450s AT nic DOT smsu DOT edu NNTP-Posting-Host: marie.a14.smsu.edu 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: > > Hye, > I thank anyone who can and will answer this question > > I have the file myfile.cc: > #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 *)' Compile with gxx instead of gcc. The problem is that gcc doesn't automatically link the iostreams library. Do this: gxx myfile.cc -o myfile.exe or preferably this: gxx -Wall myfile.cc -o myfile.exe The "-Wall" switch does wonders to prevent debugging horrors later. :)