Fcflags and flibs

Hello,
I have installed SDL on my mac osx from command line and am running one
of the first test programs in the documentation. I am using the compile
command:

gcc -o test test.c sdl-config --cflags --libs,

which is on the linux FAQ page (no compilation instructions on the mac
osx FAQ page),
and I get the following error message:

cc1: unrecognized option -fcflags' cc1: unrecognized option-flibs’

I don’t understand how to fix this because I don’t know where these
libraries are. I have checked in all of the SDL libraries with no luck.
I also have sdl-config in the source code’s directory so that’s not the
problem. Any assistance would be greatly appreciated.
Thank you,
Daniel Roberts

Hello,
I have installed SDL on my mac osx from command line and am running
one of the first test programs in the documentation. I am using the
compile command:

gcc -o test test.c sdl-config --cflags --libs,

which is on the linux FAQ page (no compilation instructions on the mac
osx FAQ page),
and I get the following error message:

cc1: unrecognized option -fcflags' cc1: unrecognized option-flibs’

I don’t understand how to fix this because I don’t know where these
libraries are. I have checked in all of the SDL libraries with no
luck. I also have sdl-config in the source code’s directory so that’s
not the problem. Any assistance would be greatly appreciated.

You forgot the backticks. sdl-config is a shell script that spits out
the compilation and linker flags used when SDL was compiled. What you
should be typing is something like:
gcc -o test test.c sdl-config --cflags --libs

However, in my experience, Xcode or Project Builder would make your
life a whole lot easier than doing this crap by hand or with Makefiles.

-bob
-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040518/13ca4c79/attachment.binOn May 18, 2004, at 10:43 PM, Daniel Roberts wrote:

— Daniel Roberts wrote:

Hello,
I have installed SDL on my mac osx from command line
and am running one
of the first test programs in the documentation. I
am using the compile
command:

gcc -o test test.c sdl-config --cflags --libs,

When you pass an unrecognized long option (and option
beginning with --) Apple’s GCC turns that into a -f
option. Therefore, --foo becomes -ffoo.

sdl-config is a program that comes with unix style SDL
that will print out useful things to help you compile
and link your SDL application. On my system, this
happens:

$ sdl-config --cflags --libs
-I/opt/local/include/SDL -D_THREAD_SAFE
-L/opt/local/lib -lSDLmain -lSDL -framework Cocoa

-framework OpenGL

These are options that you can pass to GCC. In bash,
enclosing a string inbetween back-ticks (`) executes
that string as a command, and then replaces it with
the output of that command. So for instance:

$ echo `echo HI`
HI
$ echo `HI`
bash: HI: command not found

In short, you forgot to use the backtick. Compile like
so:

gcc -o test test.c sdl-config --cflags --libs

In the future, you may want to look at not linking to
the OpenGL library if you don’t need it.__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/