Re: GCC Compile Failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux