c++ aggregate 'std::stringstream ss' has incomplete type and cannot be defined
聚合类型不完整,没有定义
绯浅yousa 2017-09-24 17:36:15 23934 已收藏 5
分类专栏: c++
版权
c++ aggregate ‘std::stringstream ss’ has incomplete type and cannot be defined
这个问题是使用了stringstream这个类,但没有包含头文件ssteam的缘故(现在头文件
strstream已经被放弃了,现在使用的头文件sstream)
==========我自己出问题是由于fp重复定义了,重复定义导致报错=====
$ g++ processlock.cpp main.cpp
main.cpp: In function ‘int main()’:
main.cpp:28:18: error: aggregate ‘std::ifstream fp’ has incomplete type and cannot be defined
28 | std::ifstream fp;
| ^~
main.cpp:64:18: error: aggregate ‘std::ofstream fp’ has incomplete type and cannot be defined
64 | std::ofstream fp;
| ^~
增加#include <sstream>即可解决
————————————————
版权声明:本文为CSDN博主「绯浅yousa」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_15437667/article/details/78078172