error LNK2005: struct SDL_Window * screen (?screen@@3PEAUSDL_Window@@EA) already defined in main.obj

在.cpp中定义全局变量

SDL_Window* screen_;
SDL_mutex* screen_mutex;
SDL_Renderer* renderer;
VideoState* global_video_state;
uint64_t global_video_pkt_pts = AV_NOPTS_VALUE;
AVPacket flush_pkt;
int video_stop = 0;
int pause_count = 0;
int bar_visibility = 0;

在.h中声明全局变量

extern SDL_Window* screen_;
extern SDL_mutex* screen_mutex;
extern SDL_Renderer* renderer;
extern VideoState* global_video_state;
extern uint64_t global_video_pkt_pts;
extern AVPacket flush_pkt;
extern int video_stop;
extern int pause_count;
extern int bar_visibility;

posted @ 2021-01-14 12:16  MoonXu  阅读(71)  评论(0编辑  收藏  举报