|
This thread is locked; no one can reply to it. |
1
2
|
Unresolved external _main |
Ceagon Xylas
Member #5,495
February 2005
|
I'm using Borland 5.5 to compile this script:
And I get an error... I thought I knew how to fix this, but after an hour, I'm still clueless |
Ultio
Member #1,336
April 2001
|
You don't need the semicolon after END_OF_MAIN(). Also, are you sure you have the IDE linking against Allegro? In addition to that, why are you including winalleg.h? As far as I can tell, with the code you have there, you don't need to include it. I may be wrong though. I've never used Borland to compiled anything in regards to Allegro. --- |
Mark Oates
Member #1,146
March 2001
|
hmm.... you did include liballeg? That's the only thing I can think of. -- |
Arthur Kalliokoski
Second in Command
February 2005
|
I think you have to COMMENT OUT the "#include <winalleg.h>", which is more for if the allegro stuff is just a module in a larger windows prog? They all watch too much MSNBC... they get ideas. |
BAF
Member #2,981
December 2002
|
why borland? Try mingw? |
Arthur Kalliokoski
Second in Command
February 2005
|
BAF, have you ever used the Turbo Debugger? I like it way better than any other debugger including gdb. Once you get it working then back to mingw! (Some small tests I did had Borland anywhere as fast as mingw on the "good" end to 20 percent slower on the "bad" end, and LCC was 70 percent slower! Although asm beat them all by 20 percent) (mandelbrot set) They all watch too much MSNBC... they get ideas. |
ReyBrujo
Moderator
January 2001
|
_main is used by DOS and console projects. When you create a Win32 project, it will try to use _WinMain. So, you built a console project. Try adding #define ALLEGRO_USE_CONSOLE before including Allegro, or create a Win32 project instead of a console one. -- |
Ceagon Xylas
Member #5,495
February 2005
|
I've tried everything suggested here, (except for ReyBrujo's suggestion to make a win32 project,) and none of them work. Borland doesnt use projects (as far as i know), so how would I go about building this program as a Win32 project... I tried #define ALLEGRO_USE_CONSOLE but still got the same error >.< [edit] If I include the winalleg.h, it gives me a list of errors -- Error: Unresolved external '_install_allegro' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_install_keyboard' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_set_gfx_mode' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_text_mode' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_makecol' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_font' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_screen' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_textprintf' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_readkey' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '_allegro_exit' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ Error: Unresolved external '__WinMain' referenced from C:\BORLAND\BCC55\BIN\MAIN.OBJ
|
ReyBrujo
Moderator
January 2001
|
Now all your errors are linking errors, so you forgot to link against Allegro library. Which command line you used? You forgot to put alleg.lib somewhere. -- |
Ceagon Xylas
Member #5,495
February 2005
|
I've tried bcc32 -IC:\borland\bcc55\include -LC:\borland\bcc55\lib -LC:\borland\bcc55\lib\alleg.lib -tW main.cpp //same WinMain error and bcc32 -IC:\borland\bcc55\include -LC:\borland\bcc55\lib\alleg.lib -tW main.cpp //unable to open C0W32.obj
|
BAF
Member #2,981
December 2002
|
figure out cow32.. Try #define ALLEGRO_NO_MAGIC_MAIN too. |
Ceagon Xylas
Member #5,495
February 2005
|
w00t! I finally got it -- even though my program crashes.. Hehehe... Ok, so what I finally had to do was only include stdlib.h and allegro.h. bcc32 -IC:\borland\bcc55\include -LC:\borland\bcc55\lib -tW main.cpp
I thought I had tried this before -- apparently it liked me this time and let me compile... Now I have to figure out why its crashing [edit] It crashes too... Its nothing that has to do width Allegro -- sence I compiled this dependant of Allegro. I compiled it without the -tW switch, and it works fine. |
BAF
Member #2,981
December 2002
|
What does -tW do? |
Ceagon Xylas
Member #5,495
February 2005
|
compiles as a win32 application. [edit] |
Tobi Vollebregt
Member #1,031
March 2001
|
BAF: Ceagon Xylas said: Ok, adding the -tW switch builds it as a win32 program. EDIT: beaten ________________________________________ |
Ceagon Xylas
Member #5,495
February 2005
|
After 12 hours...Still no luck xD |
ReyBrujo
Moderator
January 2001
|
Check makefile.bcc, there is the command line used to compile with Borland BCC. Search for the ilink command. -- |
marcin
Member #5,814
May 2005
|
Make config files: Bcc32.cfg -DWINVER=0x0400 Ilink32.cfg -L"c:\Borland\Bcc55\lib" Options: -DWINVER=0x0400 are undocumented but they are necessary for winXP. And "-tW" option is for WINAPI programs and for allegro, I think, you need command line window program (both types are WIN programs, command line isn't DOS program ). [url] (Copy and paste this link as text into your browser, it doesn't work directly, I don't know why...) COX32.obj is run time library, I had problem with it at start of manual compiling and linking. If you first create *.obj and next you want link *.obj files you have to add to linker command line switches run time libraries explicite. So the best way is to compile and link at once. I have found it, the best link, you have everything about manual linking here: [url] (Copy and paste this link as text into your browser, it doesn't work directly, I don't know why...) I used bcc5.5 but I have checked that gcc (devc++ or with cygwin) under winXP gives much faster code. |
Ceagon Xylas
Member #5,495
February 2005
|
Quote: COX32.obj is run time library, I had problem with it at start of manual compiling and linking. If you first create *.obj and next you want link *.obj files you have to add to linker command line switches run time libraries explicite. So the best way is to compile and link at once.
How do I go about doing this? ...Sorry about takin so long to reply; was on vacation. |
Matt Smith
Member #783
November 2000
|
Quote: and for allegro, I think, you need command line window program No, you want a windowed application, even if your program runs full screen |
marcin
Member #5,814
May 2005
|
Could you write, once again, command line you actually use. Did you make Bcc32.cfg and Ilink32.cfg files? Did you read /allegro-x.x.x/docs/build/bcc32.txt file (section Using Allegro) ? |
Ceagon Xylas
Member #5,495
February 2005
|
Quote: Could you write, once again, command line you actually use.
I change it up all the time...but its something like Quote: Did you make Bcc32.cfg and Ilink32.cfg files? Did you read /allegro-x.x.x/docs/build/bcc32.txt file (section Using Allegro)? Yes. |
marcin
Member #5,814
May 2005
|
Quote: bcc32 -Lc:\borland\bcc55\lib -Ic:\borland\bcc55\lib -tW main.cpp ( -Ic:\borland\bcc55\lib ) "-I" switch is path to include folder not to lib folder ------------------------------------ Quote:
bcc32 -Lc:\borland\bcc55\lib -Ic:\borland\bcc55\lib -tW main.cpp Yes. So you don't need in command line "-L" and "-I" switches because you have it in Bcc32.cfg file. ------------------- Do you have allegro.lib file in: Do you have allegro headers in: Do you have allegro.dll in system folder? Quote: bcc32 -Lc:\borland\bcc55\lib -Ic:\borland\bcc55\lib -tW main.cpp main.cpp is: allegro program or "hello world" command line program or "hello world" WINAPI program? If it's allegro program you have to add to command line allegro.lib file that has information about functions in allegro.dll (*.lib is export library for *.dll dynamic library) If it's only "hello ..." command line program "-tW" option is bad. If it's "hello ..." GUI program "-tW" option is necessary but you need code for creating example windows window (calling WINAPI functions) (about one page of code), not simply "hello ..." code with main() function. ******************************************** EDIT: HA HA HA HA HA HA HA HA HA.......;D --------------------------------------------------------------- E:\E\src\allegro\examples>bcc32 exhello.c alleg.lib -tW Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland exhello.c: Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Error: Unresolved external '_main' referenced from C:\BORLAND\BCC55\LIB\C0X32.OBJ E:\E\src\allegro\examples> --------------------------------------------------------------- E:\E\src\allegro\examples>bcc32 -tW exhello.c alleg.lib Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland exhello.c: Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland E:\E\src\allegro\examples> ---------------------------------------------------------------- Do you see the difference !!! HA HA HA, 5 days, HA HA HA ...... ******************************************** |
Ceagon Xylas
Member #5,495
February 2005
|
ROTFL! but theres still a problem... Um... when i try to run my program -- it crashes... I have the dlls in the folder, and not using any other outside sources... |
Tobias Dammers
Member #2,604
August 2002
|
Two words: --- |
|
1
2
|