This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC Compile Failure
- From: ArtÅras Moskvinas <arturas dot moskvinas at gmail dot com>
- To: jjdevine at adelphia dot net
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 09 Jul 2006 00:05:16 +0300
- Subject: Re: GCC Compile Failure
- References: <200607081320.49645.jjdevine@adelphia.net>
> Hello GCC Helpers,
>
> This is a program I wrote:
>
> #include <glibc>
> #include <stdio.h>
> void cout();
> main()
> {printf "Hello World. /n";
> cout << "Hello/n";
> return 0;
> }
>
cout is not a function, it is an object. You can't declare it like this.
Second, you wrote C++ code, and you are compiling it using C compiler
(use g++ command instead of gcc). Third there is no such library glibc,
I think you meant stdlib.h. The correct code might look like this:
#include <iostream>
#include <stdio.h>
int main()
{
printf("Hello World. \n");
std::cout << "Hello\n";
return 0;
}
Arturas M.