|
Borland C++ Builder problem with Allegro |
Matheus Kerkhoff
Member #5,151
October 2004
|
Please, Could someone explain me how to declare the main function of my Allegro Aplication. I am using a console project. #include <allegro.h> int main(void) { return 0; }END_OF_MAIN(); LinkerError: [Linker Error] Unresolved external '_main' referenced from C:\ARQUIVOS DE PROGRAMAS\BORLAND\CBUILDER6\LIB\C0X32.OBJ PS: I've tried the compiler attributes management with -tW or -tWC. Nothing works. Thx in advance... |
lucaz
Member #4,194
January 2004
|
Are you using the -lalleg flag to the compiler?. #include <allegro.h> int main() { return 0; } END_OF_MAIN() // dont use ';' commandline> g++ mygame.cpp -lalleg [EDIT:] (check again your question) |
ReyBrujo
Moderator
January 2001
|
Either use a Win32 application project, or check the Allegro documents: Allegro.txt said: If you want to build a console application using Allegro, you have to define Also, as lucaz said, don't use the ending semicolon. -- |
Di Domênico
Member #5,135
October 2004
|
Matheus is my friend. And he asked me to post that the PROBLEM IS STILL ALIVE. I tried to define ALLEGRO_USE_CONSOLE and the linker still get an error. Tried to remove the END_OF_MAIN and the problem still alive. Please help!!! |
ReyBrujo
Moderator
January 2001
|
Did you build Allegro for BCC? Or downloaded a precompiled package? If so, from where? -- |
Di Domênico
Member #5,135
October 2004
|
I've downloaded in Allegro.cc >> Files all the includes.........the source...... hmm..have I to build the allegro??? the headers and the dll's are there... |
Matt Smith
Member #783
November 2000
|
There are also the stub libs (alleg.lib alld.lib allp.lib), which are in MSVC .lib format in the binary download. Maybe these are incompatible with your version of BCC, so you should build allegro from the source. |
Di Domênico
Member #5,135
October 2004
|
C++Builder 6.0 I've no idea how to build the Allegro......... why just cant WORK???? what is the real ALLEGRO MAIN FUNCTION definitition?] The error is simples... Cannot find the _main reference.....but no way to resolve them.. Please!!!!! |
ReyBrujo
Moderator
January 2001
|
You need to compile Allegro for your own system. Try adding some other Allegro function, and you will see it won't find it neither. Read the building docs for BCC to learn how to do it. Which version of BCC you are using? (Edited: Moving thread to correct forum) (Edited: The precompiled version of Allegro for BCC is a bit old. I guess you downloaded it. Then, you forgot to link Allegro with your application) -- |
Di Domênico
Member #5,135
October 2004
|
Sorry....but what you mean "link allegro"?? the include is fine.....remember that if I change the compiler to ANSI, the error goes to ZERO_BASE and data definition..... |
ReyBrujo
Moderator
January 2001
|
First, you are using the BCC 5.5 free command line compiler or some other? -- |
Di Domênico
Member #5,135
October 2004
|
Using the registered and paid version of Borland C++ Builder 6.0. |
ReyBrujo
Moderator
January 2001
|
So, I guess it has a GUI. Check the compiler options/linker or something like that. Sorry, you will have to find yourself the right option, as I own the free compiler version. Allegro was compiled for BCC 5.5, so it might not be compatible with your own BCC version. -- |
Di Domênico
Member #5,135
October 2004
|
Thank your atention. Friend, so, just explain me what is the magic allegro main().....maybe with this reference I will try ti resolve the problem.....but I still cant believe that cannot just work...... So friend, why using system.h, in a winapi aplication, compiler raises redeclaration of BITMAP??? Arent allegro compatible with win applications???? Getting crazy....but I will download the BCC 5.5 and try to make this work!!!! Really thanks......suggestion is wondered... |
Evert
Member #794
November 2000
|
Quote: Friend, so, just explain me what is the magic allegro main().....maybe with this reference I will try ti resolve the problem.....but I still cant believe that cannot just work......
As said, you need to link against the Allegro library and make sure that you have the (correct) headers for the library installed. Quote: why using system.h, in a winapi aplication, compiler raises redeclaration of BITMAP??? Arent allegro compatible with win applications???? Windows also defines a BITMAP type, different from Allegro's BITMAP. The solution is to #include <winalleg.h> before including Windows-specific header files and after #including <allegro.h>. |
Jeremy McCleese
Member #5,241
November 2004
|
Quote: Sorry....but what you mean "link allegro"?? the include is fine.....remember that if I change the compiler to ANSI, the error goes to ZERO_BASE and data definition..... It sounds like he is just not grasping the idea of having to link the library to the project. Go to the linker options in C++ Builders IDE and make sure that you have alleg.lib included. r30y162part2 |
Di Domênico
Member #5,135
October 2004
|
OK... now I tried to add the allegro libs directly to linker.... I edited my projetct settings with the line below: When I build my project, the linker says: [Linker Error] 'C:\PROGRAM FILES\BORLAND\CBUILDER6\LIB\LIBALDAT.A' contains invalid OMF record, type 0x21 (possibly COFF) The library path is OK............ Thinking hard to forgot allegro, but I'm still sure that something could be done... Thanks |
Evert
Member #794
November 2000
|
The Borland compiler is an old compiler, and one that Allegro wasn't tested on much, I think. Is there a particular reason you insist on using it rather than better maintained compilers, such as MSVC or MinGW, where Allegro is known to work properly? Anyway, you should probably also try to use the MSVC linker library (alleg.lib) rather than the MinGW one (liballeg.a) with BCC. Some other remarks: Quote: libaldat.a What is this? Quote: liballeg_s.a liballeg.a You only need one of those, not both. |
Di Domênico
Member #5,135
October 2004
|
We wanna work with BCC just because we are advanced Delphi programmers Maybe we will use Visual Studio........but just if we really can't with bcc.........ok I'll try with the msvc alleg.lib.... |
|