[FFmpeg-devel] [PATCH] cmdutils: move "#undef main" from ffplay.c to cmdutils.h

Stefano Sabatini stefano.sabatini-lala at poste.it
Fri Jun 3 13:36:54 CEST 2011

From: Carl Eugen Hoyos <cehoyos at ag.or.at>

On Windows/MinGW the SDL cflags re-define the main() function
function, which results in a linking error if not reverted.

Since the addition of the SDL output device, SDL cflags are used also
for compiling ffmpeg and ffprobe, so we need to move this trick from
ffplay.c to a common header.

Fix trac issue #256.
 cmdutils.h |    4 ++++
 ffplay.c   |    6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmdutils.h b/cmdutils.h
index eea4401..eca98a3 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -29,6 +29,10 @@
 #include "libavformat/avformat.h"
 #include "libswscale/swscale.h"
+#ifdef __MINGW32__
+#undef main /* We don't want SDL to override our main() */
  * program name, defined by the program for show_version().
diff --git a/ffplay.c b/ffplay.c
index 74d1f10..5997f65 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -43,14 +43,10 @@
 # include "libavfilter/avfiltergraph.h"
-#include "cmdutils.h"
 #include <SDL.h>
 #include <SDL_thread.h>
-#ifdef __MINGW32__
-#undef main /* We don't want SDL to override our main() */
+#include "cmdutils.h"
 #include <unistd.h>
 #include <assert.h>

More information about the ffmpeg-devel mailing list