|
|
| Wierdest error I have ever seen |
|
kazzmir
Member #1,786
December 2001
|
As you can tell by the incredibly informative title, i have a strange error. Here is the exact code I am using. TMenu::TMenu( BITMAP * _background, int x, int y, int major_val ): middle_x( x ), middle_y( y ), major( major_val ){ // error on this line background = _background; previous = NULL; mouse.x = x; mouse.y = y; mouse.grab( background ); selected = NULL; } On the line i have commented, i get this error from gcc: TMenu.cpp:13:anachronistic old style base class initializer TMenu.cpp:13: unnamed initializer for 'TMenu', which has no base classes The above code worked before i added major( major_val ) so i have no idea what an anachronistic old style whatever is. |
|
23yrold3yrold
Member #1,134
March 2001
|
What type is major? -- |
|
kazzmir
Member #1,786
December 2001
|
cmon, im not stupid. major is an int. |
|
23yrold3yrold
Member #1,134
March 2001
|
Is major inherited (and I assume middle_x and middle_y are not)? If so, initialize that variable in the constructor body instead ... -- |
|
kazzmir
Member #1,786
December 2001
|
TMenu is a base class that no class is derived from. All variables are contained in TMenu. Major is declared in the next line down from middle_x, middle_y, more specifically it is declared protected. Yes, declaring it in the constructor body works but i was just wondering why the way im doing it gives an error. |
|
gillius
Member #119
April 2000
|
Is major defined as a macro somewhere. I had that problem in a class once that some macro from a UNIX header happened to be the same name, and it generated weird warnings. Try playing with the spaces, seeing if it's a bug in GCC. Make sure the initializer list is in order of declaration (but that would give you a warning, and not an error). Gillius |
|
kazzmir
Member #1,786
December 2001
|
Yea, apparently this code reveals a warning: #ifdef major #warning WTF?? #endif Upon further investigation, major is defined by <vector>. I searched through the STL header files, but found no mention of major. [edit] found it, or found a major being defined somewhere in the system. In /usr/include/linux/kdev_t.h on line 81 it defines major as #define major(d) MAJOR(d)
|
|
|