delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/26/07:31:19

From: weiku AT UTKUX1 DOT UTK DOT EDU ("Wei Ku")
Subject: Re: Embarassing question on linking
26 May 1997 07:31:19 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199705260756.DAA37171.cygnus.gnu-win32@solid.ssd.ornl.gov>
Mime-Version: 1.0
X-Mailer: Microsoft Outlook Express 4.71.0544.0
Original-To: <gnu-win32 AT cygnus DOT com>
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE Engine V4.71.0544.0
Original-Sender: owner-gnu-win32 AT cygnus DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_01BC6988.DE5655C0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

 ----
From: Allan Peda <allan AT interport DOT 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 AT utkux DOT utcc DOT utk DOT 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 AT solid DOT ssd DOT ornl DOT gov
***************************************

To: gnu-win32 AT cygnus DOT 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 AT cygnus DOT com" with one line of text: "help".



------=_NextPart_000_01BC6988.DE5655C0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<HTML><META content=3D'"Trident 4.71.0544.0"' name=3DGENERATOR>

</HEAD>
<BODY>
<P><FONT face=3DArial size=3D2><FONT size=3D2> ----<BR>
<B>From: </B>Allan Peda &lt;allan AT interport DOT net&gt;<BR>
Now under hello.c, I have no errors,&nbsp; I'm guessing that I need to =
do=20
something to link the correct libraries which are needed under (G)C++, =
and were=20
included by default under GCC (ansi).<BR>
<FONT face=3DArial size=3D2><FONT size=3D2> =
----</FONT></FONT></FONT></FONT>

<P><FONT face=3DArial size=3D2><FONT size=3D2>1. use g++ instead of =
gcc</FONT></FONT>

<P><FONT face=3DArial size=3D2><FONT size=3D2>2. use void if the =
function does not=20
return anything. ( the default return type is int if not=20
specified)</FONT></FONT><FONT face=3DArial size=3D2><FONT =
size=3D2></FONT></FONT>

<P><FONT face=3DArial size=3D2><FONT size=3D2>The following is the =
similar code=20
compiled and run in my Windows 95:</FONT></FONT>

<P><FONT face=3DArial size=3D2><FONT size=3D2><BR>
 //g/tmp/tmp ) cat hello.cpp<BR>
#include &lt;iostream.h&gt;<BR>&nbsp;
<BR>
void main()<BR>
{<BR>
         cout &lt;&lt; &quot;Hello there GNU++ world!&quot; &lt;&lt; =
endl;<BR>
}<BR>
//g/tmp/tmp ) g++ -o hello.exe hello.cpp<BR>
//g/tmp/tmp ) hello<BR>
Hello there GNU++ world!<BR>&nbsp;
</FONT></FONT>

<P><FONT face=3DArial size=3D2><FONT size=3D2>Sincerely,<BR>
Wei Ku<BR>
<BR>
***************************************<BR>
Department of Physics and Astronomy<BR>
The University of Tennessee<BR>
1408 Circle Drive<BR>
Knoxville, Tennessee 37996-1200<BR>
<A =
href=3D"mailto:weiku AT utkux DOT utcc DOT utk DOT edu">weiku AT utkux DOT utcc DOT utk DOT edu</A><BR>=

---------------------------------------<BR>
Solid State Division<BR>
Oak Ridge National Laboratory<BR>
P.O.Box 2008<BR>
Oak Ridge, TN 37831-6032<BR>
Phone: (423) 574-5795<BR>
Fax: (423) 574-4143<BR>
<A =
href=3D"mailto:weiku AT solid DOT ssd DOT ornl DOT gov">weiku AT solid DOT ssd DOT ornl DOT gov</A><BR>=

***************************************<BR>
</FONT>

<P><B>To: </B>gnu-win32 AT cygnus DOT com<BR>
<B>Date: </B>Monday, May 26, 1997 1:01 AM<BR>
<B>Subject: </B>Embarassing question on linking<BR>
<BR>
<HTML><BODY><FONT size=3D2>I am learning C++ using cygwin32, so I am not =
too well=20
versed in these<BR>
unix type utilities (previous experience with IDE based products).<BR>
<BR>
I'll cut to the chase..&nbsp; hello world based C++ program yields =
the<BR>
following:<BR>
<BR>
The code:<BR>
<BR>
bash$ cat hellopp.cc<BR>
#include &lt;iostream.h&gt;<BR>
<BR>
main()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;Hello =
there GNU++=20
world!\n&quot;;<BR>
}<BR>
bash$<BR>
<BR>
The error:<BR>
<BR>
bash$ make -f hellopp.mak<BR>
/gnuwin32/b18/H-i386-cygwin32/bin/gcc.exe -pedantic -o hellopp.exe<BR>
hellopp.cc<BR>
C:\TEMP\cc0010051.o(.text+0x2a):hellopp.cc: undefined reference to<BR>
`cout'<BR>
C:\TEMP\cc0010051.o(.text+0x2f):hellopp.cc: undefined reference to<BR>
`ostream::ope<BR>
rator&lt;&lt;(char const *)'<BR>
gcc.exe: Internal compiler error: program ld got fatal signal 1<BR>
make: *** [hellopp.exe] Error 1<BR>
<BR>
<BR>
Thanks<BR>
Allan<BR>
<BR>
(Yes, I am reading the notes at cygnus, and am looking into<BR>
prep.mit.edu)<BR>
-<BR>
For help on using this list (especially unsubscribing), send a message =
to<BR>
&quot;<A=20
href=3D"mailto:gnu-win32-request AT cygnus DOT com">gnu-win32-request AT cygnus DOT com=
</A>&quot;=20
with one line of text: &quot;help&quot;.<BR>
</FONT></P>
</FONT>
</BODY></HTML>

------=_NextPart_000_01BC6988.DE5655C0--

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019