Strange segfault from SDL_FreeSurface

后端 未结 2 1496
清歌不尽
清歌不尽 2021-01-24 04:48

I have the following simple SDL code:

#include 
#include 
#include 

// helpers

bool init(SDL_Window **win, SDL_Sur         


        
相关标签:
2条回答
  • 2021-01-24 05:19

    I can confirm this. Same scenario. Even with -Wall and -Wextra the compiler did not spit out a redeclaration warning. Same for open().

    I need an experts' opinion if this is a gcc bug.

    • Solution 1: declare your close() as a static function (e.g. static close()).
    • Solution 2: rename your close() function to something else (e.g. my_close_foo()).
    0 讨论(0)
  • 2021-01-24 05:30

    Please rename your function

    void close(SDL_Window **win, SDL_Surface **surf)
    

    since close is a standard C library function.

    0 讨论(0)
提交回复
热议问题