C++ 编译错误:有初始化程序但类型不完整
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13428164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++ compile error: has initializer but incomplete type
提问by Aneem
I am coding in Eclipse and have something like the following:
我在 Eclipse 中编码并且有如下内容:
#include <ftream>
#include <iostream>
void read_file(){
char buffer[1025];
std::istringstream iss(buffer);
}
However, when I try to build, I get the following error: variable 'std::istringstream iss' has initializer but incomplete type
但是,当我尝试构建时,出现以下错误: variable 'std::istringstream iss' has initializer but incomplete type
Any quick thoughts? I have googled around and it seems like most people with this problem simply did not include the right header files which I believe I am doing correctly.
有什么快速的想法吗?我用谷歌搜索了一下,似乎大多数遇到这个问题的人都没有包含正确的头文件,我相信我做得对。
回答by Jive Dadson
You need this include:
你需要的包括:
#include <sstream>