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