Complete newbie needs gcc compiler help
From: James Bond (jbond_at_ue.com)
Date: Mon, 14 Jun 2004 09:17:37 -0400
I am a newbie to linux programming, and am trying to learn a little c++.
And much to my chagrin, I am having problems at the very beginning: I
can't get the compiler to work properly.
After perusing hundreds of useful online resources for c++ and linux
programming, I have discovered that nearly everything assumes you can
already use the compiler effectively. Reading the man page for gcc makes
it look easy, but I am stumbling somewhere.
Trying to write a simple hello world program,using a regular text editor,
I type this (comes from a Sam's book on c++ programming):
cout << "Hello World.\n";
I save this to hello.cpp and then from the command line I type "g++ -o
I get the message the cout is undefined. It looks just like this:
[jb@localhost Source]$ g++ -o hello hello.cpp
hello.cpp: In function `void Main()':
hello.cpp:9: error: `cout' undeclared (first use this function)
hello.cpp:9: error: (Each undeclared identifier is reported only once
for each function it appears in.)
g++ -v tells me that I am using:
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
To me, that error implies that either cout is not defined in the iostream
library, yet my book, and several other sources, are quite clear that it
is. Otherwise, I assume I am doing something wrong with the compiler.
Finally, I guess that I might not have the proper libraries installed, but
if that is the case, I have been unable to determine just what I need.
Any help getting over this early hurdle is greatly appreciated. Thank you.