“winapifamily.h: No such file or directory” when compiling SDL in Code::Blocks

后端 未结 3 2112
抹茶落季
抹茶落季 2020-12-04 15:38

I am following along with the SDL2.0 tutorials by LazyFoo, using Code::Blocks 13.12. I have had no trouble getting SDL2 linked and running in VS2010 but have changed IDE and

相关标签:
3条回答
  • 2020-12-04 16:13

    The quick fix. Comment out lines 121 to 132 inclusively in SDL_platform.h The file loads into C::B when the error occurs. Save it and build away!

    0 讨论(0)
  • 2020-12-04 16:23

    UPDATE: SDL 2.0.4 is now out, includes a fix for this bug, and is available for download at http://libsdl.org/download-2.0.php


    This is a bug in SDL 2.0.3. A fix has been committed for SDL's next release. In the meantime, here's a link to the fixed copy of SDL_platform.h:

    https://hg.libsdl.org/SDL/raw-file/e217ed463f25/include/SDL_platform.h

    If you drop the file into SDL 2.0.3's include\SDL2\ directory, overwriting the original, your app(s) should compile ok.

    0 讨论(0)
  • 2020-12-04 16:26

    I had that problem. Go to

    C:\Program Files (x86)\Windows Kits\8.0\Include\shared
    

    and find winapifamily.h, then copy it to your

    ..\Mingw\Include\ folder
    

    Edit: I think I have windows kits files because of visual studio 2012 or later, sorry. I am glad you could solve your problem.

    Yeap, the problem is in that header (lines 117 to 134 in SDL_plataform.h version SDL 2.0.3):

    #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
    /* Try to find out if we're compiling for WinRT or non-WinRT */
    /* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
    #if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)    /* _MSC_VER==1700 for MSVC 2012 */
    #include <winapifamily.h>
    #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
    #undef __WINDOWS__
    #define __WINDOWS__   1
    /* See if we're compiling for WinRT: */
    #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
    #undef __WINRT__
    #define __WINRT__ 1
    #endif
    #else
    #undef __WINDOWS__
    #define __WINDOWS__   1
    #endif /* _MSC_VER < 1700 */
    #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
    
    0 讨论(0)
提交回复
热议问题