Need help with a very simple program

CodeLite installation/troubleshooting forum
techningeer
CodeLite Curious
Posts: 1
Joined: Fri Feb 11, 2011 6:17 am
Genuine User: Yes
IDE Question: C++
Contact:

Need help with a very simple program

Post by techningeer » Fri Feb 11, 2011 6:38 am

I am using the CodeLite IDE. I compiled the following program using CodeLite (It is a C++ program):

#include <iostream.h>
int main()
{
cout << "Hello World\n";
return (0);
}

It returns this message:

g++ -c "/home/keagan/.coding-work/Hello/printamessage.cc" -g -o ./Debug/printamessage.o "-I." "-I."
/home/keagan/.coding-work/Hello/printamessage.cc:1:23: error: iostream.h: No such file or directory
/home/keagan/.coding-work/Hello/printamessage.cc: In function ‘int main()’:
/home/keagan/.coding-work/Hello/printamessage.cc:4: error: ‘cout’ was not declared in this scope
make[1]: *** [Debug/printamessage.o] Error 1
make: *** [All] Error 2

Anybody have any idea how to fix this? It seems to be a library issue...

--thanks, techningeer

User avatar
eranif
CodeLite Plugin
Posts: 6120
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Need help with a very simple program

Post by eranif » Sat Feb 12, 2011 12:10 am

1) This is not a C++ forum - but codelite forum. Your question is not related to codelite
2) <iostream.h> is deprecated, you should use this instead:

Code: Select all


#include <iostream> // note that there is no ".h"
using namespace std; // you must add this, other wise you should write your code like this: std::cout << "Hello" << std::endl;

Eran
Make sure you have read the HOW TO POST thread

Locked