Reputation: 763
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;
}
Upvotes: 7
Views: 23490
Reputation: 1
If you are an Arduino programmer don't forget that Arduino does NOT have any
normal ‘ostream’ stuff build-in.
But there is libraries offering similar functions.
PS. Bear in mind that there is good reasons that streaming type stuff is not included.
Upvotes: 0
Reputation: 76235
#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.
Upvotes: 8
Reputation: 104698
Verify that your includes all closed their namespaces -- your include may accidentally be declared in a namespace if a previous header did not close its namespaces.
You can also attempt to locate this problem by moving the std includes earlier in the include list.
Upvotes: 1