5

I recently upgraded my OSX to mountain lion and ever since I cannot compile my project using Qt Creator anymore. I get bunch of errors like the following:

/Users/user/codes/lib/io/xdmfWriter.cpp:63: 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

/Users/user/codes/lib/io/xdmfWriter.cpp:-1: In 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>]':

/Users/user/codes/lib/io/xdmfWriter.cpp:63: instantiated from here

// xdmfWriter.cpp -- line 63:
gridName << xdmfName_ << "." << timeStep;

gridName is a std::ostringstream object and xdmfName_ is a std::string variable declared as a private member of the xdmfWriter class and initialized in the class constructor. I did not have this problem before ... Any ideas?

mmirzadeh
  • 6,893
  • 8
  • 36
  • 47

3 Answers3

6

This can be fixed by adding a c_str() as in:

gridName << xdmfName_.c_str() << "." << timeStep;

However, this is not a permanent solution.

Update: I found the solution in https://web.archive.org/web/20140809210004/http://qt-project.org/forums/viewthread/19106/P15

You need to change -mmacosx-version-min=10.5 in $QTDIR/mkspecs/common/g++-macx.conf to -mmacosx-version-min=10.7. This is because SDKs for 10.5 or 10.6 are not included in Mountain Lion and XCode 4.4.

cgmb
  • 4,284
  • 3
  • 33
  • 60
sordid
  • 177
  • 6
  • Ugh... I'm kinda stuck on this one.. where does QT dump all that stuff with a standard install? – Sam Jarman Jan 19 '13 at 11:21
  • 1
    You can run `qmake -v` to get the location fo your qt directory, for me that's `/usr/local/Cellar/qt/4.8.4/lib`. The `mkspecs` directory will then be one level above that, or for my example, `/usr/local/Cellar/qt/4.8.4/mkspecs`. – sordid Feb 27 '13 at 14:49
6

I have tried changing the g++-macx.conf fila but I was still getting the errors. I found that using:

QMAKE_CXXFLAGS += -fpermissive

on my pro file did the trick.

wotaskd
  • 925
  • 1
  • 10
  • 15
2

Sounds like if I use the Clang toolchain (which forces clang++ instead of llvm-g++) I do not have this problem ...

mmirzadeh
  • 6,893
  • 8
  • 36
  • 47
  • how did you do this? some option in QT Creator or something else? – Sam Jarman Jan 19 '13 at 11:18
  • @SamJarman Depends on QtCreator version. Before it was in the Qt version > toolchain. Withe the new release (2.6 I guess) the whole thing is changed to "kits" ... – mmirzadeh Jan 20 '13 at 00:44