public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: gcc library
@ 1999-07-07  7:55 Wei  Xu
  1999-07-31 18:34 ` Wei  Xu
  0 siblings, 1 reply; 10+ messages in thread
From: Wei  Xu @ 1999-07-07  7:55 UTC (permalink / raw)
  To: Jonathan Pryor, cygwin

Thanks for your reply.

Your example works with g++. When I use gcc, still the same mistake:
undefined reference.


-----Original Message-----
From: Jonathan Pryor <jonpryor@vt.edu>
To: Wei Xu <weixuz@yesic.com>; cygwin@sourceware.cygnus.com
<cygwin@sourceware.cygnus.com>
Date: Wednesday, July 07, 1999 10:40 AM
Subject: Re: gcc library


><iostream.h> doesn't provide the prototype for printf.
>You need to include <stdio.h>.
>
>Also, the use of <iostream.h> has been deprecated by
>the C++ standard.  You should use <iostream>, which
>places everything in the std namespace.  Additionally,
><stdio.h> has been deprecated in favor of <cstdio>,
>which also places the contents into the std namespace;
>however, not all compilers support <cstdio>, so I tend
>to stick with <stdio.h>...
>
>    // example....
>    #include <iostream>
>    #include <stdio.h>
>
>    using namespace std;
>
>    int main ()
>    {
>      cout << "Hello, world!\n";
>      printf ("Hello again, world!\n");
>      return 0;
>    }
>
> - Jon
>----- Original Message -----
>From: Wei Xu <weixuz@yesic.com>
>To: <cygwin@sourceware.cygnus.com>
>Sent: Wednesday, July 07, 1999 10:15 AM
>Subject: gcc library
>
>
>> Dear all,
>>
>> I an new to this software. I have download the full verions of  Cygwin.
>When
>> I try to testing the =
>> gcc with the following C++ code:
>>
>> #include <iostream.h>
>>
>> int main (int argc, char **argv)
>> {
>>   cout << "Hello world\n";
>>     printf("Hello world\n");
>> }
>>
>>
>> It says:
>>
>> try.cc: In function `int main(int, char **)':
>> try.cc:6: warning: implicit declaration of function `int printf(...)'
>> C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x1e):try.cc: undefined reference to =
>> `cout'
>> C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x23):try.cc: undefined reference to =
>> `ostream::
>> operator<<(char const *)'
>> collect2: ld returned 1 exit status
>>
>> I can figure out what is wrong with my installation or library?=20
>> Here is my set:
>>
><snipped...>
>


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: gcc library
@ 1999-07-07  7:54 Thomas Pfaff
  1999-07-31 18:34 ` Thomas Pfaff
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Pfaff @ 1999-07-07  7:54 UTC (permalink / raw)
  To: Wei  Xu, cygwin

-----Original Message-----
From: Wei Xu <weixuz@yesic.com>
To: cygwin@sourceware.cygnus.com <cygwin@sourceware.cygnus.com>
Date: Mittwoch, 7. Juli 1999 16:28
Subject: gcc library


>try.cc: In function `int main(int, char **)':
>try.cc:6: warning: implicit declaration of function `int printf(...)'
>C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x1e):try.cc: undefined reference to =
>`cout'
>C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x23):try.cc: undefined reference to =
>`ostream::
>operator<<(char const *)'
>collect2: ld returned 1 exit status

Compile with g++ instead of gcc, otherwise the required library 'libstdc++'
is not included when linked.

-Thomas



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread
* gcc library
@ 1999-07-07  7:16 Wei  Xu
  1999-07-07  7:41 ` Jonathan Pryor
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Wei  Xu @ 1999-07-07  7:16 UTC (permalink / raw)
  To: cygwin

Dear all,

I an new to this software. I have download the full verions of  Cygwin. When
I try to testing the =
gcc with the following C++ code:

#include <iostream.h>

int main (int argc, char **argv)
{
  cout << "Hello world\n";
    printf("Hello world\n");
}


It says:

try.cc: In function `int main(int, char **)':
try.cc:6: warning: implicit declaration of function `int printf(...)'
C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x1e):try.cc: undefined reference to =
`cout'
C:\WINDOWS\TEMP\ccz14xFI.o(.text+0x23):try.cc: undefined reference to =
`ostream::
operator<<(char const *)'
collect2: ld returned 1 exit status

I can figure out what is wrong with my installation or library?=20
Here is my set:

BASH_VERSION=3D'2.02.1(2)-release'
BLASTER=3D'A220 I2 D3 H7 P330 T6'
CMDLINE=3Dbash
COMSPEC=3D'C:\COMMAND.COM'
CTSYN=3D'C:\WINDOWS'
DIRSTACK=3D()
EUID=3D500
GROUPS=3D()
HISTFILE=3D/.bash_history
HISTFILESIZE=3D500
HISTSIZE=3D500
HOSTNAME=3DXu
HOSTTYPE=3Di586
IFS=3D'
'
INCLUDE=3D'C:\MICROS~1\VC98\ATL\INCLUDE;C:\MICROS~1\VC98\INCLUDE;C:\MICRO=
S~1\VC98\
MFC\INCLUDE;'
LIB=3D'C:\MICROS~1\VC98\LIB;C:\MICROS~1\VC98\MFC\LIB;'
MACHTYPE=3Di586-pc-cygwin32
MAILCHECK=3D60
MAKE_MODE=3DUNIX
MSDEVDIR=3D'C:\MICROS~1\COMMON\msdev98'
MSVCDIR=3D'C:\MICROS~1\VC98'
OLDPWD=3D/
OPTERR=3D1
OPTIND=3D1
OSTYPE=3Dcygwin32
PATH=3D/CYGNUS/CYGWIN~1/H-I586~1/BIN:/MICROS~1/COMMON/MSDEV98/BIN:/MICROS=
~1/VC98/B
IN:/MICROS~1/COMMON/TOOLS/WIN98:/MICROS~1/COMMON/TOOLS:/SYSTEM:/PROGRA~1/=
TEXMF/M
IKTEX/BIN:/WINDOWS:/WINDOWS/COMMAND:/PROGRA~1/BIN:/PROGRA~1/JDK1.2/BIN:/M=
ICROS~1
/COMMON/MSDEV98/BIN
PIPESTATUS=3D([0]=3D"1")
PPID=3D1000
PROMPT=3D'$p$g'
PS1=3D'\s-\v\$ '
PS2=3D'> '
PS4=3D'+ '
PWD=3D/Tmp
SHELL=3D/bin/sh
SHELLOPTS=3Dbraceexpand:hashall:histexpand:monitor:history:interactive-co=
mments:em
acs
SHLVL=3D1
TEMP=3D'C:\WINDOWS\TEMP'
TERM=3Dcygwin
TMP=3D'C:\WINDOWS\TEMP'
UID=3D500
WINBOOTDIR=3D'C:\WINDOWS'
WINDIR=3D'C:\WINDOWS'
_=3Dtry.cc



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-07-31 18:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-07  7:55 gcc library Wei  Xu
1999-07-31 18:34 ` Wei  Xu
  -- strict thread matches above, loose matches on Subject: below --
1999-07-07  7:54 Thomas Pfaff
1999-07-31 18:34 ` Thomas Pfaff
1999-07-07  7:16 Wei  Xu
1999-07-07  7:41 ` Jonathan Pryor
1999-07-31 18:34   ` Jonathan Pryor
1999-07-07  7:47 ` Raju K. V.
1999-07-31 18:34   ` Raju K. V.
1999-07-31 18:34 ` Wei  Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).