当我在线复制一些好的信息并将它们粘贴在Microsoft OneNote上时,它可以说明问题
粘贴自[website_address]
我做了一些搜索,但很难找到他们是如何做到的.如何将此功能添加到软件?
我正在尝试用 C++ 编写类和结构,例如:
using namespace std;
struct Position {
int x;
int y;
};
class Maze {
Position pos;
pos.x = 0;
pos.y = 0;
};
int main() {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试编译它时会出现一些错误:
(gcc 版本 4.3.2)
10: error: ISO C++ forbids declaration of 'pos' with no type
10: error: expected ';' before '.' token
11: error: ISO C++ forbids declaration of 'pos' with no type
11: error: expected ';' before '.' token
Run Code Online (Sandbox Code Playgroud)
看起来这段代码与C++ Tutorial: Struct 中的代码几乎相同。
对其他一些关于“错误:ISO …