I'm starting to learn how to use the Allegro library with C++ on my own. My compiler is MSVisual C++ 6.0. The book I am learning out of is "Game Programming All In One, Third Edition" by Jonathan S. Harbour. I've been able to get all of the programs so far to run correctly except for the first one after setting up the compiler to statically link. I've installed the SDK for Direct X properly and the compiler has no problems linking. Yet, I can't get the first "GetInfo" program on pages 81-82 to work!
I use an empty Win32 app and saved the main program as main.c. I open up the Project Settings (I didn't see Project Properties)/Link and replace everything in the "Object/Library Modules" text box with the following: alleg.lib alleg_s.lib gdi32.lib winmm.lib ole32.lib dxguid.lib dinput.lib ddraw.lib dsound.lib
My Code exactly as I have it copied:
NOTE - I have the "extern char allegro_id[];" as a comment because I don't know whether to include it or not.
I get one warning "warning C4013: 'printf' undefined; assuming extern returning int"
If I add the "extern char" line, it doesn't seem to make a bit of difference...
I've checked my C++ reference guide and I think I've done everything right! I've copied from the first "#include" to the "END_OF_MAI N()" exactly like it is in the book... What am I doing wrong? I've been trying to make it work for almost a month and I know it's got to be something simple that I'm missing... Help me please!
Silver Leaf
I use an empty Win32 app and saved the main program as main.c. I open up the Project Settings (I didn't see Project Properties)/Link and replace everything in the "Object/Library Modules" text box with the following: alleg.lib alleg_s.lib gdi32.lib winmm.lib ole32.lib dxguid.lib dinput.lib ddraw.lib dsound.lib
My Code exactly as I have it copied:
Code:
#define ALLEGRO_STATICLINK
#include <stdlib.h>
#include <allegro.h>
//extern char allegro_id[];
char allegro_id[] = "test string";
int main()
{
allegro_init();
printf("Allegro version = %s\n", allegro_id);
printf("\nPress any key...\n");
system("pause");
allegro_exit();
return 0;
}
END_OF_MAIN()
I get one warning "warning C4013: 'printf' undefined; assuming extern returning int"
If I add the "extern char" line, it doesn't seem to make a bit of difference...
I've checked my C++ reference guide and I think I've done everything right! I've copied from the first "#include" to the "END_OF_MAI N()" exactly like it is in the book... What am I doing wrong? I've been trying to make it work for almost a month and I know it's got to be something simple that I'm missing... Help me please!
Silver Leaf
Comment