When I try to compile the code below (in a Qt 4.8 using llvm-g++-4.2 (GCC) 4.2.1), I get the following error:
../GLWidget.cpp:24: instantiated from here
../GLWidget.cpp:24: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
What does this error mean, and what should I do to fix it?
Source code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void testOStream(){
filebuf fb;
fb.open ("test.txt",ios::out);
std::ostream os(&fb);
std::string test("test");
os << test; // This line has the problem
fb.close();
}
As @ChadCambell pointed out, the problem turned out to be that Qt 4.8 uses -mmacosx-version-min=10.5, but should have been -mmacosx-version-min=10.7
I found some more use info of the problem here:
http://qt-project.org/forums/viewthread/19106/P15
Updating to Qt 5.0 also solves the problem