Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual c++ 奇怪的错误_Visual C++ - Fatal编程技术网

Visual c++ 奇怪的错误

Visual c++ 奇怪的错误,visual-c++,Visual C++,我在类中定义了方法,出现了此错误。 错误C2371:重新定义;不同的基本类型 我的方法: Buffer::SetSourceCode(string str) { SourceCode=str; } 我的班级: class Buffer { string SourceCode; int Index; int PreIndex; int Length; public: void SetSourceCode(st

我在类中定义了方法,出现了此错误。 错误C2371:重新定义;不同的基本类型

我的方法:

Buffer::SetSourceCode(string str)
    {
        SourceCode=str;
    }
我的班级:

class Buffer
{
    string SourceCode;
    int Index;
    int PreIndex;
    int Length;
    public:
        void SetSourceCode(string str);
        void SetSourceFromFile();
        string CopyString();
        string Copy();
        void SetPreIndex(void);
        void IncreaseIndex();
        void ReturnBack();
        bool IsEnd();
        char ReadChar();
        Buffer(void);
        ~Buffer(void);
    };
什么是错误?
谢谢。

据我所知,缓冲区是Visual C++中类的“保留”(现有)名称。您的类尝试重新定义现有类型


尝试包含标题:

#include <string> using namespace std; #包括 使用名称空间std;
你是说
std::string
?返回类型到哪里去了?