Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to build muParser: error: explicit instantiation of 'std::basic_ostream but no definition available

Im trying to build muParser on the mac, it worked until I upgraded XCode to 4.4 which updated gcc. Now I get the following line of code generating the error which I don't understand:

mu::console() << _T(" \"") << val.GetAsString() << _T("\" ");

../muparser/src/muParserBase.cpp:1823:   instantiated from here
../muparser/src/muParserBase.cpp:1823: 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
../muparser/src/muParserBase.cpp: 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>]':
../muparser/src/muParserBase.cpp:1823:   instantiated from here
../muparser/src/muParserBase.cpp:1823: 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
../muparser/src/muParserBase.cpp: 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>]':
../muparser/src/muParserBase.cpp:1823:   instantiated from here
../muparser/src/muParserBase.cpp:1823: 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
../muparser/src/muParserBase.cpp: 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>]':
../muparser/src/muParserBase.cpp:1823:   instantiated from here
../muparser/src/muParserBase.cpp:1823: 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

mu::console() is define as:

inline std::ostream& console()
{
  return std::cout;
}

_T is #define _T(x) x

and GetAsString

  const TString& GetAsString() const
  {
    return m_strTok;
  }

TString is a std::string

It is the call to GetAsString that causes the problem. Any idea how to fix it?

like image 921
Roland Rabien Avatar asked Jul 31 '12 20:07

Roland Rabien


1 Answers

Add these two lines to your .pro file and the error will go away:

QMAKE_CFLAGS_X86_64 += -mmacosx-version-min=10.7
QMAKE_CXXFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64
like image 169
RawMean Avatar answered Nov 14 '22 21:11

RawMean