Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

gcc does not find c++ headers

The latest installation of gcc does not compile c++ programs

#include<iostream.h>

    int main() {
      cout << "This is test\n";
     return 0;
    }

results in fatal error: <iostream.h> no such file or directory However in /usr/include/c++/7 there is a iostream file, so I tried this

#include<iostream>

  int main() {
  cout << "This is test\n";
 return 0;
}

which results in,

 ostreamtest.cc: In function ‘int main()’:
test.cc:5:4: error: ‘cout’ was not declared in this scope
    cout << "This is a test\n";
    ^~~~
test.cc:5:4: note: suggested alternative:
In file included from test.cc:1:0:
/usr/include/c++/7/iostream:61:18: note:   ‘std::cout’
   exte cout;  /// Linked to standard output
                  ^~~~