Embarassing question on linking

Wei Ku weiku@UTKUX1.UTK.EDU
Mon May 26 00:59:00 GMT 1997


 ----
From: Allan Peda <allan@interport.net>
Now under hello.c, I have no errors,  I'm guessing that I need to do 
something to link the correct libraries which are needed under (G)C++, and were 
included by default under GCC (ansi).
 ----

1. use g++ instead of gcc

2. use void if the function does not 
return anything. ( the default return type is int if not 
specified)

The following is the similar code 
compiled and run in my Windows 95:


 //g/tmp/tmp ) cat hello.cpp
#include <iostream.h>  

void main()
{
         cout << "Hello there GNU++ world!" << endl;
}
//g/tmp/tmp ) g++ -o hello.exe hello.cpp
//g/tmp/tmp ) hello
Hello there GNU++ world!  


Sincerely,
Wei Ku

***************************************
Department of Physics and Astronomy
The University of Tennessee
1408 Circle Drive
Knoxville, Tennessee 37996-1200
weiku@utkux.utcc.utk.edu
---------------------------------------
Solid State Division
Oak Ridge National Laboratory
P.O.Box 2008
Oak Ridge, TN 37831-6032
Phone: (423) 574-5795
Fax: (423) 574-4143
weiku@solid.ssd.ornl.gov
***************************************


To: gnu-win32@cygnus.com
Date: Monday, May 26, 1997 1:01 AM
Subject: Embarassing question on linking

I am learning C++ using cygwin32, so I am not too well 
versed in these
unix type utilities (previous experience with IDE based products).

I'll cut to the chase..  hello world based C++ program yields the
following:

The code:

bash$ cat hellopp.cc
#include <iostream.h>

main()
{
        cout << "Hello there GNU++ 
world!\n";
}
bash$

The error:

bash$ make -f hellopp.mak
/gnuwin32/b18/H-i386-cygwin32/bin/gcc.exe -pedantic -o hellopp.exe
hellopp.cc
C:\TEMP\cc0010051.o(.text+0x2a):hellopp.cc: undefined reference to
`cout'
C:\TEMP\cc0010051.o(.text+0x2f):hellopp.cc: undefined reference to
`ostream::ope
rator<<(char const *)'
gcc.exe: Internal compiler error: program ld got fatal signal 1
make: *** [hellopp.exe] Error 1


Thanks
Allan

(Yes, I am reading the notes at cygnus, and am looking into
prep.mit.edu)
-
For help on using this list (especially unsubscribing), send a message to
" gnu-win32-request@cygnus.com " 
with one line of text: "help".






More information about the Cygwin mailing list