代码:
while ((row = mysql_fetch_row(pRes))) {
TMPTable temp = {};
if (row[0]) temp.con = strtoul(row[0], NULL, 10);
std::vector<MATable>.push_back(temp);
}
TMPTable temp = {};
行
in C++98 'temp' must be initialized by constructor, not by '{...}'
另一个问题是:
std::ostringstream query;
给出错误:
aggregate 'std::ostringstream query' has incomplete type and cannot be defined
我在google上尝试过这些解决方案,但还没找到任何有效的解决方案......总是以错误结束。你们能指出我正确的方向吗?
答案 0 :(得分:6)
您需要添加<sstream>
才能获得std::ostringstream
的定义。要解决初始化问题,您只需使用
TMPtable tmp = TMPtable();