views:

28

answers:

1
#include "ffmpeg/libavcodec/avcodec.h"

#include "ffmpeg/libavformat/avformat.h"

#include "ffmpeg/libswscale/swscale.h"
#include "ffmpeg/libswscale/rgb2rgb.h"
#include "ffmpeg/libswscale/swscale_internal.h"

#include <stdio.h>

#ifdef __MINGW32__
#undef main /* Prevents SDL from overriding main() */
#endif

#include "SDL.framework/Headers/SDL.h"
#include "SDL.framework/Headers/SDL_thread.h"

Is Compiled with this command:

gcc -o t1 tutorial01.c -lswscale -lavutil -lavformat -lavcodec -lz -lavutil -lm -framework SDL

But I get this error:

Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: _SDL_main)
ld: symbol(s) not found
collect2: ld returned 1 exit status

From googling, If I try to add : #include "SDLMain.h" it has major Aneurisms.

A: 

Change your compilation line to:

gcc -o t1 tutorial01.c -lswscale -lavutil -lavformat -lavcodec -lz -lavutil -lm `sdl-config --cflags --libs`

On my mbp, sdl-config --cflags --libs outputs:

-I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa
karlphillip
Don't include "SDLMain.h" if you don't need it. And my guess is you don't need it.
karlphillip
-bash: sdl-config: command not found
David van Dugteren
@David replace the sdl-config at the end of the command by the other 2 lines I pasted in the end of my answer. Of course, you must check if your stuff is also on the same path as mine. If not, *find* them.
karlphillip
Thanks, Karl, I wasn't thinking, and had to ./configure, make, install SDL Source first.
David van Dugteren