![]() |
|
Is this how this is suppose to be written??? |
Alysher
Member #8,406
March 2007
![]() |
i have come across a bit of code that isn't compiling properly, and was wondering if it is just written wrong. The file that it is in is a C program, not a C++, so if any one knows if its wrong and can tell me how to fix it please do: uint64_t al_ffblk_get_size(struct al_ffblk *info) { ASSERT(info); struct FF_DATA *ff_data = (struct FF_DATA *) info->ff_data; return ff_data->data.ff_fsize; }
I didn't lose my marbles, I never had any to begin with!!! |
CGamesPlay
Member #2,559
July 2002
![]() |
Why isn't it compiling properly? -- Ryan Patterson - <http://cgamesplay.com/> |
HoHo
Member #4,534
April 2004
![]() |
Posting compiler error messages would probably help you avoid answering lots of questions __________ |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Quote: struct FF_DATA *ff_data = (struct FF_DATA *) info->ff_data; Looks to me like you're trying to mix compile time initialization with run time variables... They all watch too much MSNBC... they get ideas. |
Alysher
Member #8,406
March 2007
![]() |
it has told me that there is a parse error before 'struct' and then says that ff_data is undeclared EDIT: Quote: Looks to me like you're trying to mix compile time initialization with run time variables... there are several places in the original file that this works, but the code i wrote at the beggining of this poste is at the end of the file and is the only thing not compiling I didn't lose my marbles, I never had any to begin with!!! |
Kitty Cat
Member #2,815
October 2002
![]() |
Probably that you're trying to declare struct FF_DATA *ff_data after the ASSERT() call, and only the newest C99 compliant C compilers will allow that (MSVC is not C99 compliant, as an FYI). Also, is struct FF_DATA defined anywhere? Why are you defining Allegro's function in your code? -- |
Alysher
Member #8,406
March 2007
![]() |
would flipping the first and second lines of the function fix the problem? as for: Quote: Why are you defining Allegro's function in your code? its not my code. It is dfile.c of allegro's source code. I didn't lose my marbles, I never had any to begin with!!! |
HoHo
Member #4,534
April 2004
![]() |
Why are you messing around with Allegro code? It should work perfectly on all decent compilers. __________ |
Alysher
Member #8,406
March 2007
![]() |
when compiling allegro for djgpp i get this error: src/dos/dfile.c: In function `al_ffblk_get_size': this is the same for optimized, debugging and Profiling modes, and the install forum couldn't tell me why. I didn't lose my marbles, I never had any to begin with!!! |
HoHo
Member #4,534
April 2004
![]() |
What version of GCC does your version of DJGPP use? __________ |
Alysher
Member #8,406
March 2007
![]() |
ive used versions 4.10 and 2.9.5.3 and i get the same error. EDIT: http://www.allegro.cc/forums/thread/590431 i had started having this problem with watcom and was told to use djgpp and ended up with some of the same problems. I didn't lose my marbles, I never had any to begin with!!! |
|