PDA

View Full Version : GCC problems


katana
22nd May 2004, 08:44 PM
Sorry for the real newbie questions, but I have another.
I'm having errors using the ./configure command to install a package. It says my c compiler cannot create executables. I decided to test my gcc compiler by writing a simple "hello world" c++ program, and this was the output I got:
[root@localhost test]# g++ -o mytest mytest.cpp
mytest.cpp:1:22: iostream.h: No such file or directory
mytest.cpp: In function `int main()':
mytest.cpp:4: error: `cout' undeclared (first use this function)
mytest.cpp:4: error: (Each undeclared identifier is reported only once for each
function it appears in.)
mytest.cpp:4: error: `endl' undeclared (first use this function)

can anyone tell me what is wrong?
cheers
Darren.

sebnukem
22nd May 2004, 09:02 PM
If you're going to compile, you probably should install all the RPMs listed as Development packages because they will install all the header files (iostream.h included).

Jman
24th May 2004, 03:07 AM

Did you install the Development Tools in the Development category? Main Menu > System Settings > Add/Remove Applications if not.

wolveso
25th May 2004, 06:37 PM
also, it'd be a good idea to change

#include <iostream.h>

in your c++ program, to

#include <iostream>
using namespace std;

as the use of the .h extension for including iostream is deprecated.. but as they say, you need to install the header files first : )