开发者

Compiling SDL on a MAC

#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 -lswscal开发者_如何学Pythone -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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜