Porting help with allegro

Apprentice
Posts: 9
Joined: 2007.10
Post: #1
Hi folks,

I'm attempting to port an Allegro game which is currently available for Win32 and Linux. I'm new to both Mac's and modern C++ programming but think I have a fairly good understanding of what's involved having done some C programming some 10 odd years ago.

The code was built using KDevelop so I've jammed the lot into XCode by creating an Allegro project (after having installed Allegro framework) and adding the source files. I've also upgraded the targets as it attempted to build with Jam by default. I'm aware of some illegal code with loads of functions declared without type and I've attempted to cut these out of the loop just to get it to compile (is there a way to force it to compile without declaration?). However, I'm hitting lots of undefined symbol errors. I believe these may be due to the missing source I've removed but while some of the symbols are variables in the code, others (like _T1) aren't. Can someone verify that I've thinking correctly or am I missing something obvious due to my naivety?

Code:
usr/bin/ld: warning prebinding disabled because dependent library: @executable_path/../Frameworks/Allegro.framework/Versions/4.2.2/Allegro is not prebound
/usr/bin/ld: Undefined symbols:
_T1
Error(char const*, ...)
Fatal(char const*, ...)
yyprintname(int)
first_lexval()
init_dirsets()
init_lexelem()
YYSTART()
yydirset(int, int)
_yyannotation
_yycoordinate
_yyerror
_yygrammar
_currMap
_yylval
_yywrap
__mangled_main_address
Quote this message in a reply
Luminary
Posts: 5,125
Joined: 2002.04
Post: #2
The yy functions come from a lex/yacc grammar. Look for a .l file and a .y file. IIRC, Xcode knows how to build those by default, and just adding them to the project might be enough.
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2007.10
Post: #3
Ah, I do have a yygram.cpp file which is the offending file that has many functions that have been declared with no type. Including this file in the build results in some 90 odd errors of the ISO C++ forbids declaration of 'ostream' with no type ilk. So I've attempted to cut this file out of the loop (unsuccessfully since it appears to be referenced all over the place).

yygram.cpp is created by another compiler which is outside my scope so it's either manually modify the file which is a bit brutal when it comes to merging with the main tree or get xcode to all compiling with no type declared. Is there a way to bypass this error and compile with no types declared?
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2007.10
Post: #4
Got a bit further. I've now managed to get all the code to compile by disabling errors effectively allowing me to use declarations without type. I've now come a cropper during linking with a couple of undefined symbols. I've searched through all the source and can't find where these symbols are coming from. Any tips on tracking them down?

Code:
/usr/bin/ld: Undefined symbols:
_T1
Error(char const*, ...)
Fatal(char const*, ...)
__mangled_main_address
/Users/mongrol/dev/xcode/In1/build/In1.build/Development/In1 (Upgraded).build/Objects-normal/i386/Annot.o reference to undefined _T1
/Users/mongrol/dev/xcode/In1/build/In1.build/Development/In1 (Upgraded).build/Objects-normal/i386/Annot.o reference to undefined Error(char const*, ...)
/Users/mongrol/dev/xcode/In1/build/In1.build/Development/In1 (Upgraded).build/Objects-normal/i386/Annot.o reference to undefined Fatal(char const*, ...)
/Users/mongrol/dev/xcode/In1/build/In1.build/Development/In1 (Upgraded).build/Objects-normal/i386/Base.o reference to undefined Error(char const*, ...)
....
..etc then
/usr/local/lib/liballeg-main.a(main.o) reference to undefined __mangled_main_address
collect2: ld returned 1 exit status
Quote this message in a reply
Luminary
Posts: 5,125
Joined: 2002.04
Post: #5
Well, none of them are system functions, so they should be in your code (or maybe allegro) somewhere...
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2007.10
Post: #6
Sorted. Some functions were ifdef'd out. I now have it running nicely.

Thanks for your help.
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2007.10
Post: #7
Port released.

http://www.incursion-roguelike.net/

Thanks for the help.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL or Allegro? mac_girl 7 5,796 Mar 8, 2007 03:59 PM
Last Post: hellohenry
  Installing Allegro Nick 5 4,014 Aug 4, 2004 12:17 PM
Last Post: IBethune