c++ - Compile error "'struct' type redefinition" although it's the first definition for it -
everything working untill moved code main file new class, had following error:
error c2011: 'color1' : 'struct' type redefinition
struct color1 { color1() { red = green = blue = 0; } color1(float _red, float _green, float _blue) { red = _red; green = _green; blue = _blue; } float red, green, blue; };
any idea ?
if compiler says it's redefined, is.
my psychic debugging skills tell me moved struct source file header file, , forget include guards in header, included multiple times in source file.
edit: general rule suggest avoiding leading underscores. in cases (for example followed capital letter) they're reserved implementation , it's simplest never use leading _
instead of hoping remember rules.
Comments
Post a Comment