I use Visual Studio Express 2013 and I try to run this code:
struct opcode {
int length;
};
std::map<int, struct opcode> opcodes;
opcodes[0x20] = {
3
};
I get this error:
error C2040: 'opcodes' : 'int [32]' differs in levels of indirection from 'std::map<int,opcode,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>'
And when I hover over opcodes I get this this declaration has no storage class or type specifier.
SOLUTION
The problem of mine was that I have put the statement outside the function.
std::map<int, opcode> opcodes;without thestructkeyword. Maybe this confuses the compiler.structkeyword.