Jos*_*res 4 c++ compiler-errors
您好,我正在编写一个 IOManager,但出现此错误:
Error 1 error C2143: syntax error : missing ';' before '<class-head>'
Run Code Online (Sandbox Code Playgroud)
我的代码是这样的:
#pragma once
#include <vector>
class IOManager{
public:
static bool readFileToBuffer(std::string filePath, std::vector<unsigned char>& buffer);
};
Run Code Online (Sandbox Code Playgroud)
我不知道我做错了什么!
您使用std::string,但不包括<string>标题。将此行添加到顶部:
#include <string>
所以你会得到:
#pragma once
#include <string>
#include <vector>
class IOManager{
public:
static bool readFileToBuffer(std::string filePath, std::vector<unsigned char>& buffer);
};
Run Code Online (Sandbox Code Playgroud)
它应该工作。