Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Candunc

macrumors member
Original poster
Jul 5, 2012
42
0
Canada
I tried to compile some code, but this has shown up. I've put the SDL frameworks in both my /Library/Framework/ and ~/Library/Framework/ and compiled it manually, to no help. Any help would be awesome.

Full error report:
[Dependancies] -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL

ld: library not found for -lSDLmain
collect2: ld returned 1 exit status

Thanks in advance,
Candunc
 

szymczyk

macrumors regular
Mar 5, 2006
187
17
It sounds like you are converting some SDL code from Linux to Mac OS X. There are differences in how SDL is packaged on Linux and Mac OS X. The Mac version of SDL is a framework, not a library. When using the -lSDLmain flag on Mac OS X, you're going to get a link error because the Mac version of SDL does not have a library named SDLmain.

Are you using a makefile to compile the code? If so, remove the -lSDLmain linker flag. Use the -framework flag to link the SDL and Cocoa frameworks.
 

Madd the Sane

macrumors 6502a
Nov 8, 2010
534
73
Utah
SDLmain is the utility static library that sets up the needed environment to use an SDL app. If libSDLmain.a isn't in the SDL development Disk Image, you'll have to build it from source.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.