Mail Archives: cygwin/1999/07/07/10:47:35
<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 AT yesic DOT com>
To: <cygwin AT sourceware DOT cygnus DOT 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 AT sourceware DOT cygnus DOT com
- Raw text -