foo.cxx:9:5: error: ‘string’ does not name a type; did you mean ‘struct’?
string code;
^~~~~~
struct
foo.cxx:10:5: error: ‘string’ does not name a type; did you mean ‘struct’?
string op1;
^~~~~~
struct
foo.cxx:11:5: error: ‘string’ does not name a type; did you mean ‘struct’?
string op2;
^~~~~~
struct
foo.cxx:31:15: error: ‘string’ has not been declared
void move(string dest, string src) {
^~~~~~
foo.cxx:31:28: error: ‘string’ has not been declared
void move(string dest, string src) {
^~~~~~
foo.cxx:48:17: error: ‘string’ has not been declared
void output(string dest) {
^~~~~~
foo.cxx:55:15: error: ‘string’ has not been declared
void load(string instruction) {
^~~~~~
foo.cxx:88:5: error: expected ‘}’ at end of input
}
^
foo.cxx: In member function ‘void VM::move(int, int)’:
foo.cxx:32:30: error: request for member ‘substr’ in ‘dest’, which is of non-class type ‘int’
int idxd = stoi(dest.substr(1))-1;
^~~~~~
foo.cxx:32:20: error: ‘stoi’ was not declared in this scope
int idxd = stoi(dest.substr(1))-1;
^~~~
foo.cxx:33:18: error: invalid types ‘int[int]’ for array subscript
if (src[0] == 'R')
^
foo.cxx:35:33: error: request for member ‘substr’ in ‘src’, which is of non-class type ‘int’
int idxs = stoi(src.substr(1))-1;
^~~~~~
foo.cxx: In member function ‘void VM::output(int)’:
foo.cxx:49:25: error: request for member ‘substr’ in ‘dest’, which is of non-class type ‘int’
int idx = stoi(dest.substr(1))-1;
^~~~~~
foo.cxx:49:15: error: ‘stoi’ was not declared in this scope
int idx = stoi(dest.substr(1))-1;
^~~~
foo.cxx:50:9: error: ‘cout’ was not declared in this scope
cout<< reg[idx].data;
^~~~
foo.cxx: In member function ‘void VM::load(int)’:
foo.cxx:57:39: error: request for member ‘length’ in ‘instruction’, which is of non-class type ‘int’
char* cstr = new char[instruction.length()+1];
^~~~~~
foo.cxx:58:29: error: request for member ‘c_str’ in ‘instruction’, which is of non-class type ‘int’
strcpy(cstr,instruction.c_str());
^~~~~
foo.cxx:58:5: error: ‘strcpy’ was not declared in this scope
strcpy(cstr,instruction.c_str());
^~~~~~
foo.cxx:58:5: note: suggested alternative: ‘struct’
strcpy(cstr,instruction.c_str());
^~~~~~
struct
foo.cxx:60:17: error: ‘strtok’ was not declared in this scope
char* token=strtok(cstr,cma);
^~~~~~
foo.cxx:60:17: note: suggested alternative: ‘static’
char* token=strtok(cstr,cma);
^~~~~~
static
foo.cxx:61:9: error: ‘struct Instruction’ has no member named ‘code’
ins.code=string(token);
^~~~
foo.cxx:61:14: error: ‘string’ was not declared in this scope
ins.code=string(token);
^~~~~~
foo.cxx:61:14: note: suggested alternative: ‘struct’
ins.code=string(token);
^~~~~~
struct
foo.cxx:67:26: error: ‘NULL’ was not declared in this scope
token=strtok(NULL,cma);
^~~~
foo.cxx:70:17: error: ‘struct Instruction’ has no member named ‘op1’
ins.op1=string(token);
^~~
foo.cxx:72:17: error: ‘struct Instruction’ has no member named ‘op2’
ins.op2=string(token);
^~~
foo.cxx:74:24: error: ‘out_of_range’ is not a member of ‘std’
throw std::out_of_range("Invalid Instruction");//the VS compiler said the error came from here
^~~~~~~~~~~~
foo.cxx: In member function ‘void VM::exec()’:
foo.cxx:84:11: error: ‘struct Instruction’ has no member named ‘code’
if (ins.code == "Move") this->move(ins.op1, ins.op2);
^~~~
foo.cxx:84:42: error: ‘struct Instruction’ has no member named ‘op1’
if (ins.code == "Move") this->move(ins.op1, ins.op2);
^~~
foo.cxx:84:51: error: ‘struct Instruction’ has no member named ‘op2’
if (ins.code == "Move") this->move(ins.op1, ins.op2);
^~~
foo.cxx:85:16: error: ‘struct Instruction’ has no member named ‘code’
else if (ins.code == "Output") this->output(ins.op1);
^~~~
foo.cxx:85:51: error: ‘struct Instruction’ has no member named ‘op1’
else if (ins.code == "Output") this->output(ins.op1);
^~~
foo.cxx: At global scope:
foo.cxx:88:5: error: expected unqualified-id at end of input
}
|