-1

クラスでプライベート変数のように std::stringstream を使用したいと考えています。しかし、「宣言されていない識別子」というエラーがあります。理由を説明して、どうすればこれを行うことができるかアドバイスをください。

class Test
{
private:
    std::stringstream str;    
}
4

1 に答える 1

2

ほとんどの場合、適切なヘッダー ファイルがインクルードされていません。また、クラス定義の末尾にあるセミコロンを忘れないでください。

#include <sstream> // <== This is what you need for std::stringstream

class Test
{
private:
    std::stringstream str;    
}; // <== Don't forget the semicolon
于 2013-03-30T11:06:04.720 に答える