C++ and SDL compiling via command line? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: C++ and SDL compiling via command line? (/thread-1642.html)
C++ and SDL compiling via command line? - sugar - Mar 11, 2009 01:37 PM
I much prefer to compile via command line. I'm trying to get SDL set up and to compile correctly. I've added SDL.framework to /Library/Frameworks/
I've tried the following command, but it gives me errors about not finding SDL:
(My test program contains "#include "SDL.h")
Any ideas what I'm doing wrong?
C++ and SDL compiling via command line? - szymczyk - Mar 12, 2009 12:56 PM
Because you're using the SDL framework, you must link against the SDL framework, not libSDLmain. Use the -framework flag to link frameworks.
You're going to have to add SDLmain.m to the list of files you're compiling. You may also have to link against the Cocoa framework. If you're going to compile from the command line, you may want to create a makefile so you don't have to enter a bunch of -framework flags every time you want to compile your code.
Xcode uses gcc to compile, and the Mac version of the SDL development libraries comes with Xcode project templates. By creating an Xcode project and building it, you can see how Xcode compiles SDL programs, which will help you know what you have to do to compile from the command line. Open Xcode's build results window by choosing Build > Build Results. There will be four small buttons in the lower left corner of the build results window. Click the third button to open the build transcript, which shows you the steps Xcode takes when building a project.
C++ and SDL compiling via command line? - Volte - Mar 26, 2009 10:07 AM
Also, IIRC, -l stands for library, so you're technically telling it to look for the 'ibSDLMain' library. Try -lSDLMain next time, but szymczyk is right, you just need SDLMain.h/m in your project and then just link to -lSDL