c++ compiling “error: expected constructor, destructor, or type conversion before '=' token ”

后端 未结 4 466
暖寄归人
暖寄归人 2021-01-19 03:55

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         


        
4条回答
  •  Happy的楠姐
    2021-01-19 04:47

    Your code must be inside some function, you can't just put it in void :-) Try running the same code in main and see, what happens.

提交回复
热议问题