SDL game porting trouble: undefined symbols
I've been working on a mac port for the roguelike IVAN for some time now. Here's the main error that is stopping me, all the way at the end during the linking process:
I was able to solve this in the previous builds by adding SDL.h and SDL_main.h to the file Main.cpp that called the main function. However, the previous builds weren't endian-agnostic so even after being built, the game couldn't get too far. The devs were kind enough to send me a new version for testing, however, even with my fix that worked last time, it doesn't seem to work. When googling for this error, I see a lot of other people with similar problems....has this ever been solved? If so, how?
Thanks!
Code:
g++ -g -O2 -o ivan actset.o areaset.o charset.o charsset.o command.o coreset.o dataset.o dungeon.o game.o godset.o iconf.o id.o igraph.o itemset.o levelset.o main.o materset.o message.o object.o roomset.o script.o slotset.o trapset.o wmapset.o wskill.o ../..//FeLib/Source/libFeLib.a -L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL
ld: Undefined symbols:
_SDL_mainI was able to solve this in the previous builds by adding SDL.h and SDL_main.h to the file Main.cpp that called the main function. However, the previous builds weren't endian-agnostic so even after being built, the game couldn't get too far. The devs were kind enough to send me a new version for testing, however, even with my fix that worked last time, it doesn't seem to work. When googling for this error, I see a lot of other people with similar problems....has this ever been solved? If so, how?
Thanks!
You meed to compile SDL_main.m too.
thanks for your reply.
does that mean I have to #include it like the other two?
does that mean I have to #include it like the other two?
No, it's an additional source file. Compile it in a similar way to however you're already compiling the rest of the source files for the project.
When linking, -lSDLmain is present...that links to the compiled version of SDLmain.m, but there's still issues. From what I understand, I shouldn't also have to link to the source for that file, SDLmain.m...but I'd give it a shot if I knew how to include it in the build process...?
gcc -g `sdl-config --libs` -lSDL_image -o GameName file1.o file2.o
works for me
Sir, e^iπ + 1 = 0, hence God exists; reply!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Need help with undefined symbols error with Univeral app running under 10.3.9 | dmdmdm | 0 | 1,900 |
May 29, 2009 01:16 PM Last Post: dmdmdm |
|
| Error with Linking Symbols | Oddity007 | 1 | 2,363 |
Feb 24, 2009 06:20 PM Last Post: Oddity007 |
|
| Need help with undefined symbols error with Univeral app running under 10.3.9 | Malarkey | 1 | 2,820 |
Nov 12, 2006 12:23 PM Last Post: OneSadCookie |
|
| FlowerMan: PC-DirectX game for Macintosh - porting tools? | MarekUhrin | 13 | 6,291 |
Aug 9, 2006 11:21 AM Last Post: MarekUhrin |
|
| 'Undefined Symbols' problem with Xcode 2.3. Any ideas, please!! | scratt | 6 | 5,318 |
Jun 11, 2006 10:19 AM Last Post: scratt |
|

