Allegro Problem [source shown]

Started by
1 comment, last by konForce 16 years, 7 months ago
I've just now started back in programming, and decided to give Allegro a shot with VC++ (2005 Express Edition) since I've never worked in VC++ before, but have experience in Allegro. I've got the source code, and debugging error info here for you all to look at, so please look at it, and give me a heads up on what I'm doing incorrect.

#include <stdlib.h>
#include "allegro.h"

int main(void)
{
	//initialize Allegro
	allegro_init();

	//initialize keyboard
	install_keyboard();

	//initialize video mode to 640x480
	int ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
	if(ret!=0)
	{
		allegro_message(allegro_eror);
		return 1;
	}
	
	//display screen resolution
	textprintf(screen, font, 0, 0, makecol(255, 255, 255), "%dx%d", SCREEN_W, SCREEN_H);

	//wait for keypress
	while(!key[KEY_ESC]);

	//end the program
	allegro_exit();
	return 0;

}END_OF_MAIN()


and the debug info

------ Build started: Project: Setting Up Allegro, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\program files\microsoft visual studio 8\vc\include\allegro\internal\alconfig.h(397) : 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(404) : 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
c:\documents and settings\numb3rz\my documents\allegro projects\setting up allegro\setting up allegro\main.cpp(16) : error C2065: 'allegro_eror' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\Numb3rz\My Documents\Allegro Projects\Setting Up Allegro\Setting Up Allegro\Debug\BuildLog.htm"
Setting Up Allegro - 1 error(s), 10 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I'm gettng 1 error and 10 warnings, and I believe in the new version of Allegro 4.2.2 I've reference the alleg.lib correctly in project properties, linkers, additional dependencies, yada ya, but do I only have to reference alleg.lib, or do I have to reference other allegro libs, or have my methods been deprecated to something else I'm not aware of? Please help me. [/source]
Advertisement
Most of those are warning, the only error I see is about allegro_error at the bottom. I don't know why you would be getting that error (or the warnings), but try replacing that line with something like allegro_message("Setting graphics mode failed.");

Also, textprintf is deprecated, you should use textprintf_ex instead.
allegro_eror => allegro_error

The warnings can be disabled by configuring the Visual C++ project to not warn about potential 64-bit compatibility issues.

This topic is closed to new replies.

Advertisement