This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: gcc library
- To: "Jonathan Pryor" <jonpryor@vt.edu>, <cygwin@sourceware.cygnus.com>
- Subject: Re: gcc library
- From: "Wei Xu" <weixuz@yesic.com>
- Date: Wed, 7 Jul 1999 10:54:15 -0400
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