GCC Compile Failure

Artūras Moskvinas arturas.moskvinas@gmail.com
Sat Jul 8 21:06:00 GMT 2006


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



More information about the Gcc-help mailing list