为什么声明 stringstream 会出现 "incomplete type" 错误?

Why should declaring a stringstream turn up an error of an "incomplete type"?

我正在尝试声明一个字符串流以用于反转数字以查看它是否是回文(输入是传递给函数的 int)-

stringstream ssInput;
ssInput << input;
string reverseInput = ssInput.str();

我是根据这个问题建模的 -

Easiest way to convert int to string in C++

为什么会出现此错误?

aggregate 'std::stringstream ssInput' has incomplete type and cannot be defined| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

你收录了吗

#include <sstream>

?还应该需要添加 using namespace std 或使用完全限定名称 std::stringstream 而不是简单的 stringstream.