diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index 2d18afb..6416e2f 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -34,6 +34,11 @@
 #include "SDL_version.h"
 
 #include "begin_code.h"
+
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+#include <directfb.h>
+#endif
+
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
 extern "C" {
@@ -79,10 +84,6 @@ struct SDL_SysWMinfo;
 
 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
 
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-#include <directfb.h>
-#endif
-
 #if defined(SDL_VIDEO_DRIVER_COCOA)
 #ifdef __OBJC__
 @class NSWindow;
