C++ compile error: has initializer but incomplete type

C++CompilationIstringstream

C++ Problem Overview


I am coding in Eclipse and have something like the following:

#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

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.

C++ Solutions


Solution 1 - C++

You need this include:

#include <sstream>

Solution 2 - C++

` Please include either of these:

`#include<sstream>`

using std::istringstream; 

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAneemView Question on Stackoverflow
Solution 1 - C++Jive DadsonView Answer on Stackoverflow
Solution 2 - C++devELIOperView Answer on Stackoverflow