(SDL) command line commpiling questions
alright so I've gotten it to work on linux (arch) and Windows already so now i need to compile on Mac,
gcc pong.c -o pong -lSDL_ttf -framework Cocoa
doesn't work properly.
Here are my headers.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <SDL/SDL.h>
#include <SDL_ttf/SDL_ttf.h>
Thanks in advance.
edit: here are my errors
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:33:17: error: SDL.h: No such file or directory
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:34:24: error: begin_code.h: No such file or directory
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:232:24: error: close_code.h: No such file or directory
I've already installed SDL.framework and SDL_ttf.framework so I'm not sure what the problem is.
gcc pong.c -o pong -lSDL_ttf -framework Cocoa
doesn't work properly.
Here are my headers.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <SDL/SDL.h>
#include <SDL_ttf/SDL_ttf.h>
Thanks in advance.
edit: here are my errors
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:33:17: error: SDL.h: No such file or directory
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:34:24: error: begin_code.h: No such file or directory
/Library/Frameworks/SDL_ttf.framework/Headers/SDL_ttf.h:232:24: error: close_code.h: No such file or directory
I've already installed SDL.framework and SDL_ttf.framework so I'm not sure what the problem is.
try something like gcc pong.c -o pong -I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework SDL_ttf -framework Cocoa
Of course, you'll need to make an app bundle at some point, but hopefully that should get you started...
Of course, you'll need to make an app bundle at some point, but hopefully that should get you started...
You are also going to need to link to libSDLMain on OS X. It's a small bit of Obj-C code that interfaces with Cocoa.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
is my new error and I suppose that I would normally fix this with '-lSDLmain' but thats not really helping, ugh... would it just be easier to make a xcode project? I'd still end up doing mostof the work in vim and what not.
_main
collect2: ld returned 1 exit status
is my new error and I suppose that I would normally fix this with '-lSDLmain' but thats not really helping, ugh... would it just be easier to make a xcode project? I'd still end up doing mostof the work in vim and what not.
You need to locate SDLMain.m and SDLMain.h and add SDLMain.m to your compile, or to locate libSDLMain.a and add -L/path/to/it -lSDLMain to your compile. From memory, the former is more likely
There's actually a better SDLMain.m that makes the app *slightly* more macified; i.e. with full menus and stuff.
Yea, here it is. Aaron Sullivan is hosting it, so if it's down (I hesitate to click), he's on the forums.
Yea, here it is. Aaron Sullivan is hosting it, so if it's down (I hesitate to click), he's on the forums.
It's not magic, it's Ruby.
GRR, still cant get it
heres what I've tried
gcc pong.c -o pong -I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework SDL_ttf -framework Cocoa -LSDLMain -lSDLMain
and the error provided..
/usr/bin/ld: can't locate file for: -lSDLMain
collect2: ld returned 1 exit status
This is using the one Nayr provided ( further provided by Aaron
)
I moved the folder to the same as pong.c's and renamed it SDLMain
I guess I get this because -lSDLMain is suppose to link to a library, Im not sure how i'm suppose to do it exactly.
ive also tried copying SDLMain.m to pong.c's directory and removing -LSDLMain
and I've also tried it with and without .m attached
heres what I've tried
gcc pong.c -o pong -I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework SDL_ttf -framework Cocoa -LSDLMain -lSDLMain
and the error provided..
/usr/bin/ld: can't locate file for: -lSDLMain
collect2: ld returned 1 exit status
This is using the one Nayr provided ( further provided by Aaron
) I moved the folder to the same as pong.c's and renamed it SDLMain
I guess I get this because -lSDLMain is suppose to link to a library, Im not sure how i'm suppose to do it exactly.
ive also tried copying SDLMain.m to pong.c's directory and removing -LSDLMain
and I've also tried it with and without .m attached
put SDLMain.h and SDLMain.m in the same directory as pong.c, then do
gcc pong.c SDLMain.m -o pong -I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework SDL_ttf -framework Cocoa
gcc pong.c SDLMain.m -o pong -I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework SDL_ttf -framework Cocoa
AH HA.
I got it now.. I had to hunt down SDLMain.h, lol didn't have one.
It all works now, finally.
Thanks for all your help now I can compile it on my main system... (I know weird right?)
I won't be posting it online until I read a bit more, then fix a few more things then read some more then add some more functionality etc etc etc...
( 4 player online/realtime pong anyone? thats my goal at least.. )
I got it now.. I had to hunt down SDLMain.h, lol didn't have one.
It all works now, finally.
Thanks for all your help now I can compile it on my main system... (I know weird right?)
I won't be posting it online until I read a bit more, then fix a few more things then read some more then add some more functionality etc etc etc...
( 4 player online/realtime pong anyone? thats my goal at least.. )
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Glyph Designer Command Line app released | MikeD | 1 | 1,537 |
Jan 2, 2013 12:56 AM Last Post: NikG |
|
| C++ and SDL compiling via command line? | sugar | 2 | 4,951 |
Mar 26, 2009 10:07 AM Last Post: Volte |
|
| Port of Cortex Command? | Frejesal | 7 | 8,018 |
Dec 9, 2008 09:05 PM Last Post: montdidier |
|
| Mac os x Port of Cortex Command, it is time | Mr_Sanders | 4 | 6,163 |
Dec 9, 2008 09:03 PM Last Post: montdidier |
|
| How do you compile using the 10.3.9 SDK at the command line? | Malarkey | 2 | 2,665 |
Nov 17, 2007 12:21 PM Last Post: OneSadCookie |
|

