Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > help building small SDL app (simple makefile & g++)

help building small SDL app (simple makefile & g++)
Thread Tools
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 16, 2004, 11:06 AM
 
I've got a small SDL app that I wrote on Linux, but now want to build on OS X.

I just installed two SDL OS X packages: the binary libs, which landed in
/Library/Frameworks/SDL.framework
and the SDL development package, which put headers in
~/Library/Frameworks/SDL.framework

Here's my makefile:

Code:
# makefile for sdl_ast # APP_NAME = sdl_ast LDFLAGS = -framework SDL -framework OpenGL -framework GLUT -framework Foundation #-lglut -lGLU -lGL `sdl-config --libs` CFLAGS = -c # `sdl-config --cflags` OBJS = main.o \ OuterSpaceObject.o \ Ship.o \ Asteroid.o \ GameSpace.o \ Game.o \ BulletInterface.o \ Bullet.o $(APP_NAME): $(OBJS) g++ -o $(APP_NAME) $(LDFLAGS) $(OBJS) main.o: main.cpp g++ $(CFLAGS) main.cpp OuterSpaceObject.o: OuterSpaceObject.cpp OuterSpaceObject.hpp g++ $(CFLAGS) OuterSpaceObject.cpp Ship.o: Ship.cpp Ship.hpp OuterSpaceObject.hpp GameCommand.hpp g++ $(CFLAGS) Ship.cpp Asteroid.o: Asteroid.cpp Asteroid.hpp OuterSpaceObject.hpp g++ $(CFLAGS) Asteroid.cpp GameSpace.o: GameSpace.cpp GameSpace.hpp Ship.hpp Asteroid.hpp g++ $(CFLAGS) GameSpace.cpp Game.o: Game.cpp Game.hpp GameCommand.hpp g++ $(CFLAGS) Game.cpp BulletInterface.o: BulletInterface.cpp BulletInterface.hpp g++ $(CFLAGS) BulletInterface.cpp Bullet.o: Bullet.cpp Bullet.hpp g++ $(CFLAGS) Bullet.cpp explain: @echo "APP_NAME == $(APP_NAME)" @echo "CFLAGS == $(CFLAGS)" @echo "LDFLAGS == $(LDFLAGS)" clean: rm -f $(APP_NAME) rm -f *.o
My first problem is that g++ can't seem to find my #include:
Code:
In file included from main.cpp:3: Game.hpp:6:30: SDL/SDL_keyboard.h: No such file or directory
Any help would be greatly appreciated.
     
johnMG  (op)
Registered User
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 16, 2004, 11:09 AM
 
Yes, I realize that I should use suffix rules in my makefile, rather than all that repetition. :)

Hmm... no sdl-config script anywhere on my system...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:00 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2