C++ compile time error: expected identifier before numeric constant

后端 未结 3 435
死守一世寂寞
死守一世寂寞 2020-11-30 23:55

I have read other similar posts but I just don\'t understand what I\'ve done wrong. I think my declaration of the vectors is correct. I even tried to declare without size bu

3条回答
  •  攒了一身酷
    2020-12-01 00:08

    Since your compiler probably doesn't support all of C++11 yet, which supports similar syntax, you're getting these errors because you have to initialize your class members in constructors:

    Attribute() : name(5),val(5,0) {}
    

提交回复
热议问题