繁体   English   中英

将C ++ 11代码转换为C ++ 98

[英]Converting C++11 code into the C++98

编码:

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上尝试了解决方案,但是还没有找到任何可行的解决方案...总是以错误结尾。 你们能指出我正确的方向吗?

您需要包含<sstream>以获得std::ostringstream的定义。 要解决初始化问题,您可以简单地使用

TMPtable tmp = TMPtable();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM