codeblocks 配置SDL2、SDL2_image,找不到SDL2/SDL.h SDL.h SDL_image.h

发布时间 2023-08-11 08:55:27作者: 大帅。

codeblocks配置SDL2、SDL2_image

下载

https://github.com/libsdl-org/SDL/releases/
https://github.com/libsdl-org/SDL_image/releases

1. 解压

将SDL2_image-devel-2.6.3-mingw.zip里面x86_64-w64-mingw32的lib、bin、include对应文件
解压到SDL2-devel-2.28.2-mingw.zip\SDL2-2.28.2\x86_64-w64-mingw32\lib、bin、include对应文件夹里面。

2. 配置codeblocks

Build options -> Linker settings -> Other linker options: -lmingw32 -lSDL2 -lSDL2main -lSDL2_image

添加SDL2位置
Search directories -> Compiler: 
D:\Lvgl\SDL2-devel-2.28.2-mingw\SDL2-2.28.2\x86_64-w64-mingw32\include\SDL2
D:\Lvgl\SDL2-devel-2.28.2-mingw\SDL2-2.28.2\x86_64-w64-mingw32\include

Search directories -> Linker:
D:\Lvgl\SDL2-devel-2.28.2-mingw\SDL2-2.28.2\x86_64-w64-mingw32\lib
D:\Lvgl\SDL2-devel-2.28.2-mingw\SDL2-2.28.2\x86_64-w64-mingw32\bin