Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: "Rick Rankin" To: "Dave Braze" , Subject: RE: Date: Sun, 28 Mar 1999 18:03:12 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2212 (4.71.2419.0) In-Reply-To: <19990329001431.15887.qmail@www0b.netaddress.usa.net> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Dave, You left out a pretty relevant piece of information: the command used to invoke the compiler. If your source is in a file called hello.cc (or hello.ccp or hello.cxx), then you can compile your source below with the line g++ hello.cc -o hello I suspect that you used "gcc hello.cc -o hello". By default, gcc does not link in the C++ runtime library. You could use gcc if you want to manually specify the C++ runtime: gcc hello.cc -o hello -lstdc++ Hope that helps, Rick -- Rick Rankin rrankin AT primenet DOT com > -----Original Message----- > From: cygwin-owner AT sourceware DOT cygnus DOT com > [mailto:cygwin-owner AT sourceware DOT cygnus DOT com]On Behalf Of Dave Braze > Sent: Sunday, March 28, 1999 5:15 PM > To: cygwin AT sourceware DOT cygnus DOT com > Subject: > > > I am having problems compiling C++ programs with b20.1 on Windows 95 sr2. > Since I am trying to use cygwin to learn C++ and unix style tools both, I > don't have a good handle on the relevant terminology, but here it is. > > I can't compile a simple "hello world" program. Here it is: > > #include > > int main() > { > std::cout << "Hello world!\n"; > exit(0); > } > > I get an error like this (sorry for the long line): > > c:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib\i586-cygwi > n32\egcs-2.91.57\collect2.exe > -o hello.exe -s > c:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib\i586-cygwi > n32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib\crt0.o > -Lc:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib\i586-cyg > win32\egcs-2.91.57 > -Lc:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib > -L\cygnus\cygwin-b20\H-i586-cygwin32\lib\gcc-lib\i586-cygwin32\egc > s-2.91.57 > -Lc:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib\i586-cyg > win32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib > -L\cygnus\cygwin-b20\H-i586-cygwin32\lib\gcc-lib\i586-cygwin32\egc > s-2.91.57\..\..\..\..\i586-cygwin32\lib > -Lc:\CYGNUS\CYGWIN-B20\H-I586-CYGWIN32\BIN\..\lib\gcc-lib\i586-cyg > win32\egcs-2.91.57\..\..\.. > hello.o -lgcc -lcygwin -lkernel32 -ladvapi32 -lshell32 -lgcc > hello.o(.text+0x1e):hello.cc: undefined reference to `cout' > hello.o(.text+0x23):hello.cc: undefined reference to > `ostream::operator<<(char > const *)' > collect2: ld returned 1 exit status > make: *** [hello.exe] Error 1 > > Incidently I have no problem compiling a 'c' version of "hello world". It > seems like the problem has to do with linking to the c++ > libraries, but I'm > not sure where the problem might be in my installation. When I installed > cygwin I accepted the default install directory. Also, the same > error occurs > whether I use gcc from the command line, or use a trivial make > file. I can't > imagine that this should cause a problem, but I do have a version of djgpp > installed on my system (poverty of imagination?). > > In any event, all help will be very much appreciated. > > -Dave Braze > > > ____________________________________________________________________ > Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com. -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com