As the title suggests I'm experiencing a rather odd problem. When I try to compile a sample source code (that uses libotb) I keep getting errors like the one in the title. What is weird is that #include <iostream>
is present in the said source/header where the error is reported.
On the other hand if I extract the code from the said file and create a separate source and compile it with g++ <source_file>
it works, but if I compile with g++ -I<path_to_libotb_headers> <source_file>
I get the same error, although the source file doesn't include anything from said path.
As stated in the below comments, this issue happens with simply
#include <iostream>
int main
{
std::cerr << "Test";
return 0;
}
The std::ostream , the std::istream or the std::iostream are base classes of stream types (e.g. std::stringstream , std::fstream , etc.) in the Standard Library.
A namespace is a declarative region that provides a scope to the identifiers (the names of types, functions, variables, etc) inside it. Namespaces are used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries.
#include <ostream>
should fix it. Under C++11, #include <iostream>
is supposed to pull in all of <ostream>
, but prior to C++11 you had to do the individual #include
s.
It should be:
int main ()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With