今天用cocos2d-x 3.6版本创建了一个新的工程,用xocde编译后出现了N多个链接错误,错误如下:
Undefined symbols for architecture x86_64:
"std::basic_stringbuf
umeng::Json::valueToQuotedString(char const*) in libMobClickCpp.a(json_writer.o)
"std::basic_ios
umeng::Json::valueToQuotedString(char const*) in libMobClickCpp.a(json_writer.o)
"std::ostream::operator<<(int)", referenced from:
umeng::Json::valueToQuotedString(char const*) in libMobClickCpp.a(json_writer.o)
"std::string::_M_leak_hard()", referenced from:
umeng::Json::StyledWriter::writeIndent() in libMobClickCpp.a(json_writer.o)
"std::string::_Rep::_M_destroy(std::allocator
umeng::Json::Value::CommentInfo::setComment(char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::CZString::CZString(char const*, umeng::Json::Value::CZString::DuplicationPolicy) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::CZString::CZString(umeng::Json::Value::CZString const&) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(char const*, char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(std::string const&) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(umeng::Json::Value const&) in libMobClickCpp.a(json_value.o)
...
"std::string::_Rep::_S_terminal", referenced from:
char* std::string::_S_construct
char* std::string::_S_construct
"std::string::_Rep::_S_empty_rep_storage", referenced from:
umeng::Json::Value::CommentInfo::setComment(char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::CZString::CZString(char const*, umeng::Json::Value::CZString::DuplicationPolicy) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::CZString::CZString(umeng::Json::Value::CZString const&) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(char const*, char const*) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(std::string const&) in libMobClickCpp.a(json_value.o)
umeng::Json::Value::Value(umeng::Json::Value const&) in libMobClickCpp.a(json_value.o)
...
"std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator
char* std::string::_S_construct
char* std::string::_S_construct
"std::string::append(char const*, unsigned long)", referenced from:
umeng::Json::valueToQuotedString(char const*) in libMobClickCpp.a(json_writer.o)
umeng::Json::FastWriter::write(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::FastWriter::writeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::write(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeCommentBeforeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeCommentAfterValueOnSameLine(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
...
"std::string::append(std::string const&)", referenced from:
umeng::Json::valueToQuotedString(char const*) in libMobClickCpp.a(json_writer.o)
umeng::Json::FastWriter::writeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeCommentBeforeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeCommentAfterValueOnSameLine(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::pushValue(std::string const&) in libMobClickCpp.a(json_writer.o)
umeng::Json::StyledWriter::writeArrayValue(umeng::Json::Value const&) in libMobClickCpp.a(json_writer.o)
..................后面还有很多这里就贴一部分出来,给以后出现同样问题的时候提个醒。
解决办法:Build Phases->Link Binary With Libraries 然后添加:libstdc++.6.0.9.dylib ,之后问题就消失。