Very simple codes located in the same file \'foo.h\':
class Xface
{
public:
uint32_t m_tick;
Xface(uint32_t tk)
{
m_tick=tk;
}
}
std
C++ is not a scripting language. You can declare items outside the bounds of an executable block of code, but you cannot do any processing. Try moving the erroring code into a function like this:
int main()
{
std::map m;
Xface* tmp;
tmp = new Xface(100); **//Error**
m[1] = tmp; **//Error**
tmp = new Xface(200); **//Error**
m[2] = tmp; **//Error**
}