![]() |
|
What's going on here ? |
zenofeller_
Member #8,364
February 2007
|
allegro_wrapper.h :
allegro_wrapper.cpp
when #included from main file, compiler dies a flaming death of ...\game\source\allegro_wrapper.o(.bss+0x8) In function `Z6tickerv': and so again and again for every single variable defined. what the hell, i've been trying to figure it out for the past three hours. any ideas ? I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam) |
BAF
Member #2,981
December 2002
![]() |
You want extern before your variables in the header, then declare them as normal in the top of ONE file (usually the one you use it in most). If that var is only used in one file, it should be local to that file, and not global with the header file. |
orz
Member #565
August 2000
|
Before each variable declared in the header files, add the keyword "extern". Then duplicate their declaration in one and only one non-header file, but without the "extern". Also, remove the value assignment ("= 0") from the ones in the header file, leave that only on the ones in non-header files. Otherwise, every file that #includes a header creates a duplicate of each variable, and the multiple copies conflict with each other. edit: beaten! |
zenofeller_
Member #8,364
February 2007
|
o god almighty. (why was i thinking that'd be handled automatically by the compiler ?) I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam) |
BAF
Member #2,981
December 2002
![]() |
I'm not sure why it was telling you it was in the ticker function, but I suppose that may be something cookey with the C++ mangling or something. |
Taiko Keiji
Member #8,307
February 2007
![]() |
wrap your header in these statememts to keep it from defining multiple variables. #ifndef _HEADER_FILE_NAME_H_ #define _HEADER_FILE_NAME_H_ //put your header here #endif you shouldn't initialize the variables in the header either. Life could be better, machines could program themselves. Taiko Keiji- |
zenofeller_
Member #8,364
February 2007
|
Quote: I'm not sure why it was telling you it was in the ticker function, but I suppose that may be something cookey with the C++ mangling or something. i don't think anything's the matter with the mangling. ticker just happens to be the first function right after the #include, it has to point to something (the compiler, i mean). I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam) |
BAF
Member #2,981
December 2002
![]() |
Why would it report it in a function that it's not in? I'd think it would just say global, or nothing at all. |
zenofeller_
Member #8,364
February 2007
|
i'm pretty sure the error could be replicated without using the allegro libraries tho. if i hit a wall and need a break writing for the game i'll try it out. I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam) |
|