delorie.com/archives/browse.cgi | search |
From: | "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu> |
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 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Ofer Corshid wrote: > > Hye, > I thank anyone who can and will answer this question > > I have the file myfile.cc: > #include <iostream.h> > > 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. :)
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |