我试图在 mac 上构建 muParser,直到我将 XCode 升级到更新 gcc 的 4.4 之前它一直有效。现在我得到以下代码行,生成我不明白的错误:
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()
定义为:
inline std::ostream& console()
{
return std::cout;
}
_T
是#define _T(x) x
和GetAsString
const TString& GetAsString() const
{
return m_strTok;
}
TString
是一个std::string
导致问题的是对 GetAsString 的调用。知道如何解决吗?