GP32 Problem With Tutorial Program


invinciblegod

Member
Joined
Oct 18, 2005
Messages
158
I am doing this Tutorial. I inputed it but i get the following errors. I don't know what's wrong. Please help. I don't know what those mean.

C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp In function `int _mangled_main()':
17 C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp [Warning] `textout_centre' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:160)
[Linker error] undefined reference to `WinMain@16'
17 C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp ld returned 1 exit status
C:\Dev-Cpp\Projects\Makefile.win [Build Error] [Project1.exe] Error 1


What I Typed:


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

DATAFILE* data;

int main()
{
allegro_init();
install_keyboard();

data=load_datafile("tutorial.dat");

set_gfx_mode(GFX_AUTODETECT,320,200,0,0);

set_palette((RGB*)data[TUT_GAMEPAL].dat);

textout_centre(screen,font,"Ready. Beep.",160,100,255);
readkey();
return 0;
}

On a side note, if someone believes there is something easier to code in for newbies (newbie meaning knows how to code basic C++ with iostream and stuff), tell me. I don't know anything about sdl and allegro.
 
Not ever using Allegro.. I can tell you what those errors mean.. for one.. it says that textout_centre is deprecated. That means 'for now' it is there and works, but don't expect that function to be there in the future, so you should generally use a newer function that accomplishes that task.

Then it says that there's an undefined reference to WinMain, typically meaning that you've setup your compiler to build a windows executable. If that's what you want, you need to replace your
int main() with a BOOL WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) entry point. Do that, or build your application for a 'console' environment.
 
invinciblegod posted on Mar 28 2006 at 07:05 AM said:
I am doing this Tutorial. I inputed it but i get the following errors. I don't know what's wrong. Please help. I don't know what those mean.

C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp In function `int _mangled_main()':
17 C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp [Warning] `textout_centre' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:160)
[Linker error] undefined reference to `WinMain@16'
17 C:\Dev-Cpp\Projects\Allegro_Intro\AllegroIntro.cpp ld returned 1 exit status
C:\Dev-Cpp\Projects\Makefile.win [Build Error] [Project1.exe] Error 1
You're probably not linking with the allegro library, I imagine. Show us your makefile.

EDIT: I see you're using Dev-CPP.

Do this (cribbed from elsewhere):

1) Go to the Project menu.

2) Click Project Options

3) Click Load Object files

4) Find the Dev-C++ folder and then the LIB folder

5) On files of type select Lib files ( *.a )

6) Double Click liballeg.a

7) Compile and Run
 
Last edited by a moderator:
Back
Top