我是C ++的新手,正在使用JsonCpp将C ++对象解析为Json,反之亦然。但是,以下代码不断给出错误如下:
$("#CityId").on('click',function(e){
e.preventDefault();
var htmlText = "<ul class=ulList>";
var mainDiv = $('.divCounties');
var items = "";
for (var i = 0; i < arrCity.length; i++) {
htmlText += "<li class=ilceCaption>" + arrCity[i].text; // +"</li>";
htmlText += "<ul>";
$.getJSON("../Adds/GetCounties", {cityId: arrCity[i].value }, function(data){
$.each(data, function(i, state) {
items += state.Text;
//htmlText += "<li>" + state.Text + "</li>";
});
console.log(items); // ==> is getting correct value in this line**
});
htmlText += "</ul>";
htmlText += "</li>";
console.log(items); // ==> is getting string empty value in this line**
}
htmlText += "</ul>";
console.log(htmlText);
mainDiv.html(htmlText);
});
以下是代码Account.cpp:
Undefined symbols for architecture x86_64:
"Json::Value::Value(Json::ValueType)", referenced from:
Account::toJson() in Account.o
"Json::Value::Value(int)", referenced from:
Account::toJson() in Account.o
"Json::Value::~Value()", referenced from:
Account::toJson() in Account.o
ld: symbol(s) not found for architecture x86_64