Skip to main content
GameDev.net gamedev.net
🔒 Locked

Allegro Errors

Started by InfiniteLoop May 27, 2009 at 6:57 PM 0 replies 550+ views
Original Post
InfiniteLoop
InfiniteLoop
So I finally got Allegro up and running. I ran this code to test it, and it worked.

#include <allegro.h> // You must include the Allegro Header file

int main(int argc, char *argv[]) 
{
	allegro_init(); // Initialize Allegro
	install_keyboard(); // Initialize keyboard routines
	set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); // Change our graphics mode to 640x480

	readkey(); // Wait untill a key is pressed

	return 0; // Exit with no errors
}

END_OF_MAIN() // This must be called right after the closing bracket of your MAIN function.
                       // It is Allegro specific.


I was following a tutorial, and that was the first thing just to show how to initialize and setup the screen, etc.(Just wondering, is this supposed to show up in full screen? SDL didn't do that, but this did, and I wasn't sure if thats how it did it) Then I went to the next lesson which was to add a bitmap. Heres my code:


#include <allegro.h> // You must include the Allegro Header file

int main(int argc, char *argv[]) 
{
	allegro_init(); // Initialize Allegro
	install_keyboard(); // Initialize keyboard routines
	set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); // Change our graphics mode to 640x480

	BITMAP *my_pic = NULL; //Declare a BITMAP called my_pic, setting it to NULL
	my_pic = load_bitmap("picture.bmp", NULL); // Load our picture
	blit(my_pic, screen, 0,0,0,0,480,360);//Draw the whole bitmap to the screen at (0,0)

	readkey(); // Wait untill a key is pressed

	destroy_bitmap(my_pic); //Release the bitmap data

	return 0; // Exit with no errors
}

END_OF_MAIN() // This must be called right after the closing bracket of your MAIN function.
                       // It is Allegro specific.


So I'm like lets see how images work blah blah. I compile it and get this: main.obj : error LNK2019: unresolved external symbol _screen referenced in function "int __cdecl _mangled_main(int,char * * const)" (?_mangled_main@@YAHHQAPAD@Z) C:\Users\Austin\Documents\Visual Studio 2008\Projects\allego\Profile\allego.exe : fatal error LNK1120: 1 unresolved externals What went wrong?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.