I have a hello world C++ file including standard <iostream>
header. System is Ubuntu 14.04
Program is:
#include <iostream>
using namespace std;
int main(){
cout << endl;
cout << "Hello " <<endl;
return 0;
}
building this with g++:
g++ main.cpp -o main
gives:
In file included from main.cpp:1:0:
/usr/include/c++/4.8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
main.cpp:6:13: error: ‘endl’ was not declared in this scope
cout << endl;
^
main.cpp:6:13: note: suggested alternative:
In file included from /usr/include/c++/4.8/iostream:39:0,
from main.cpp:1:
/usr/include/c++/4.8/ostream:564:5: note: ‘std::endl’
endl(basic_ostream<_CharT, _Traits>& __os)
^
hello.cpp: In function ‘void print_hello()’:
hello.cpp:5:4: error: ‘cout’ was not declared in this scope
cout << "Hello World!";
^
hello.cpp:5:4: note: suggested alternative:
In file included from hello.cpp:1:0:
/usr/include/c++/4.8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
Do I need to configure path to standard libraries somewhere?
EDIT
I changed <iostream.h>
to <iostream>
but problem remains in another form.