Date: Wed, 24 May 2000 09:36:00 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Marcelo Juchem cc: "'djgpp AT delorie DOT com'" Subject: Re: HELP WITH C++ COMPILING: UNDEFINED REFERENCE appears when using functions from IOSTREAM.H In-Reply-To: <01BFC526.FE13C1C0@mdm122.plug-in.com.br> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 24 May 2000, Marcelo Juchem wrote: > gcc hiworld.cpp > gcc -lstdcxx hiworld.cpp > gcc -lstdcxx -o2 hiworld.cpp > gcc -lstdcxx -lgpp hiworld.cpp > gcc -lstdcxx -lgpp -o2 hiworld.cpp > > But it didn't worked at all. I tried everything that's in the FAQs and other stuff. All my enviroment files/variables/.../setup/installation are ok. The following output is generated from gcc: > > d:/djgpp/tmp\cckLVI2c.o(.text+0x1b):hiworld.cpp: undefined reference to 'cout' > d:/djgpp/tmp\cckLVI2c.o(.text+0x1b):hiworld.cpp: undefined reference to 'ostream::operator<<(char const *)' > collect2: ld returned 1 exit status Your command line is all wrong. Try this: gcc -O2 hiworld.cpp -o hiworld.exe -lstdcxx Note the order (-lstdcxx is last), and Capital O in -O2. Also note the "-o hiworld.exe" part. This is all explained in the FAQ and in the file README.1ST which comes with DJGPP.