SDL库的下载与配置(Visual Studio )2024/2/4更新

一.SDL的下载

下载链接



二.SDL的环境配置

解压以后放在中文路径下

不会添加环境变量自行搜索(比较简单网上教程很多)

下面进行编译器的配置




复制这段内容

c 复制代码
x64\SDL2main.lib
x64\SDL2.lib

将这段代码放进去运行一下

c 复制代码
#include <SDL.h>

int main(int argc, char* argv[]) {
    SDL_Window* window = NULL;
    SDL_Renderer* renderer = NULL;

    SDL_Init(SDL_INIT_VIDEO);

    window = SDL_CreateWindow("SDL Example", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, 0);
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); // 设置绘制颜色为红色
    SDL_RenderClear(renderer); // 清空渲染器
    SDL_RenderPresent(renderer); // 将绘制的内容显示到窗口上

    SDL_Delay(3000); // 等待3秒

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);

    SDL_Quit();

    return 0;
}

这样就是成功了!!!

相关推荐
开开心心就好11 小时前
二维码批量生成导出工具,离线可用完全免费
java·前端·人工智能·智能手机·github·excel·visual studio
1024奇点11 小时前
【仓颉语言入门 · 第24课】
开发语言·ide·开源
重生之我复员之后重当黄毛12 小时前
vscode配置c/c++环境
c语言·前端·visual studio
开开心心就好2 天前
超市定时播音软件,免费版支持循环播放
智能手机·ffmpeg·ocr·word·vim·音视频·visual studio
oooost2 天前
Jupyter Notebook 常用快捷键速查
ide·python·jupyter
yqj2343 天前
ESP32-S3中小智项目优化内容
ide·macos·xcode
VIP_CQCRE3 天前
Visual Studio 也能接入统一 AI 能力:用 Ace Data Cloud + LMLocal 打通 OpenAI 兼容模型
openai·ai编程·开发工具·visual studio·acedatacloud
阿斌.com3 天前
Visual Studio 2026安装全攻略
ide·visual studio
VIP_CQCRE3 天前
在 Visual Studio 里接入 AI 编程助手:用 Ace Data Cloud + LMLocal 打通 OpenAI 兼容模型
ai编程·visual studio·openai兼容·ace data cloud·lmlocal
我要神龙摆尾3 天前
IDEA 阅读插件
java·ide·intellij-idea·idea-plugs·plugs