delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/07/07/10:47:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <043701bec886$c08e32b0$e63d2509@raleigh.ibm.com>
From: "Jonathan Pryor" <jonpryor AT vt DOT edu>
To: "Wei Xu" <weixuz AT yesic DOT com>, <cygwin AT sourceware DOT cygnus DOT com>
References: <003901bec883$34bc9e00$c3dba1d1 AT Xu DOT toronto DOT vr1 DOT com>
Subject: Re: gcc library
Date: Wed, 7 Jul 1999 10:40:34 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300

<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 -


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