![]() |
|
Problems displaying Allegro's global variables |
Jeff Something
Member #5,942
June 2005
|
I purchased a game programming book recently that uses Allegro as it's library. One of the first exercises after setting up Allegro is creating a program that displays some of Allegro's global variables, such as the library version, OS name and version, etc. However other than the library version, nothing is displayed correctly and anything beyond the OS name and version crashes the program. I've tried two different compilers and get the same results. This is the source code to the small program.
When the program runs, it displays my OS as Unknown (even though I'm running Win XP SP2), the version as -1.-1, and multithreading as No. I'm running a Compaq Presario R3200 AMD Athlon XP Mobile 2800+ 1.6Ghz with 256mb RAM with Win XP SP2. Is it a problem with my setup, my laptop hardware, or a bug in allegro? EDIT: I just realized I'm retarded and forgot the most important thing - allegro_init(); Duh. |
kazzmir
Member #1,786
December 2001
![]() |
Run allegro_init() first. |
ReyBrujo
Moderator
January 2001
![]() |
allegro_init initializes those variables. -- |
Jeff Something
Member #5,942
June 2005
|
Yea, I just realized that after I posted it.. fast replies Maybe you guys could help me out with something else though. In MSVC8 when I compile any allegro program I always get 12 warnings, even with the warning level set at 1: c:\program files\microsoft visual studio 8\vc\include\allegro\internal/alconfig.h(378) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\internal/alconfig.h(385) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(421) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(435) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned char *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(446) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(460) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(471) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(485) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned short *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(521) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size c:\program files\microsoft visual studio 8\vc\include\allegro\inline/draw.inl(535) : warning C4312: 'type cast' : conversion from 'unsigned int' to 'unsigned int *' of greater size .\test.c(69) : warning C4996: 'getch' was declared deprecated
|
Michael Faerber
Member #4,800
July 2004
![]() |
The last message is probably easy to remove: don't include conio.h, and don't use the function getch(). If you really want the program to wait for a keypress, you could use system("PAUSE") instead. Both ways are not very portable and will only work on the Windows platform. -- |
Evert
Member #794
November 2000
![]() |
When you're cleaning that up, get rid of conio.h. You neither need nor want it. |
Matthew Leverton
Supreme Loser
January 1999
![]() |
To disable the warnings: #pragma warning( disable : 4312 ); |
|