Jump to content
  • Advertisement
Sign in to follow this  
polisasimo

Allegro errors during tutorial?

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello I have just gone through the allegro installation tutorial. During the first tutorial I have come across and don't understand the following errors when compiling. here is the code
/*******************
Allegro Newbie Tutorial

 


#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 will set the graphics mode that you will
	use in your program.

    Here is what each paramater is

	set_gfx_mode(GRAPHICS MODE, Width, Height, Virtual Width, Virtual Height);

	GFX_AUTODETECT for a graphics mode will set everything for you, using
	the machine's preinstalled drivers.
    
	The width and the height are simple that, the width and the height of
	the screen.

    The V_Width and V_Height are the virtual (not visible) width and height
	of the screen. We don't need to worry about these for the moment, so entering
	0's will just create NO virtual screen.
	****************************/
	set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); // Change our graphics mode to 640x480

	
											   
											   
	/********************************************
	This function stops the program untill a key
	is pressed
	********************************************/
	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.








here are the errors: chris fatal error LNK1120: 6 unresolved externals chris error LNK2019: unresolved external symbol __imp___WinMain referenced in function _WinMain@16 chris error LNK2019: unresolved external symbol __imp__install_allegro referenced in function "int __cdecl _mangled_main(int,char * const)" (?_mangled_main@@YAHHQAD@Z) chris error LNK2019: unresolved external symbol __imp__install_keyboard referenced in function "int __cdecl _mangled_main(int,char * const)" (?_mangled_main@@YAHHQAD@Z) chris error LNK2019: unresolved external symbol __imp__set_gfx_mode referenced in function "int __cdecl _mangled_main(int,char * const)" (?_mangled_main@@YAHHQAD@Z) chris error LNK2019: unresolved external symbol __imp__readkey referenced in function "int __cdecl _mangled_main(int,char * const)" (?_mangled_main@@YAHHQAD@Z) c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\allegro\inline\draw.inl(365): warning C4312: 'type cast' : conversion from 'unsigned long' to 'unsigned long *' of greater size any help on this matter would be appreciated. [Edited by - polisasimo on March 28, 2005 5:25:20 PM]

Share this post


Link to post
Share on other sites
Advertisement
Your code looks fine to me.Try linking these in the linker from projects-> project options
-lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound
and this in the C++ compiler from projects->project options
-DALLEGRO_STATICLINK

If you still get errors; download the DirectX dev-pak.

Share this post


Link to post
Share on other sites
[edit] Whoa, hothead killed me! Either I type too slow or you type too fast [grin]

You will need to link in -lalleg This can be done in the: Project->Project Options->Parameters->Linker Box. It will compile after that assuming you made the correct C++ format console project [smile]

Share this post


Link to post
Share on other sites
I am using the .net2003 compiler. Under project there is no .... what is the correct term?.... Option for "project options." However under properties I can open up a box for linker. under linker I have the following categories:

general
input
debugging
system
embedded IDL
optimization
advanced
command line

am I on the right track

ps thanks so far

Share this post


Link to post
Share on other sites
Holy cow! I wonder why I assumed you were using Dev-CPP as well [lol] That's just crazy, your error says "Microsoft Visual Studio .NET". Anyways, Project->Properties->Linker->Input then add in alleg.lib to the Additional Dependecies edit box. Then that *should* compile fine.

Well I know why, most people that use Allegro 99% of the time use Dev-CPP [smile] I think you are the first encounter with a .Net compiler in a while.

Share this post


Link to post
Share on other sites
Allright that killed some of the errors, by the way in the learning curve (which is where I am sitting this help is awesome), but a few remain:

chris fatal error LNK1120: 1 unresolved externals

chris error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup

round two

Share this post


Link to post
Share on other sites
I did create a Win32console project, I have included the #include <winalleg.h> line but....

allegro error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
allegro fatal error LNK1120: 1 unresolved externals

(I created a new project just to be safe that is why the chris is now allegro)


Hrmpph

Share this post


Link to post
Share on other sites
Ok had to look this one up:
Above your include file, add:
#define USE_CONSOLE

And it will compile. You do not need the Winalleg.h after all. This problem has came up before, but I don't think the answer was ever found. Here is the reference link for you.

Share this post


Link to post
Share on other sites
Drew you are the master. Thanks also to hothead.

I am a CS140 student going way over my head considering I have just learned what a call by reference function is :)

Just out of curiosity are you guys or gals programmers by trade, if so how is the job market?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!