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;
}

这样就是成功了!!!

相关推荐
VIP_CQCRE2 小时前
Visual Studio 也能接入统一 AI 能力:用 Ace Data Cloud + LMLocal 打通 OpenAI 兼容模型
openai·ai编程·开发工具·visual studio·acedatacloud
阿斌.com2 小时前
Visual Studio 2026安装全攻略
ide·visual studio
VIP_CQCRE2 小时前
在 Visual Studio 里接入 AI 编程助手:用 Ace Data Cloud + LMLocal 打通 OpenAI 兼容模型
ai编程·visual studio·openai兼容·ace data cloud·lmlocal
我要神龙摆尾9 小时前
IDEA 阅读插件
java·ide·intellij-idea·idea-plugs·plugs
千谦阙听11 小时前
【C++篇】:string类——常用接口、底层原理与深浅拷贝
开发语言·c++·学习·visual studio
梦幻通灵12 小时前
IDEA 实用快捷键【持续更新】
java·ide·intellij-idea
风华同学1 天前
vscode远程连接
ide·vscode·编辑器
kiss strong1 天前
idea显示前进后退按钮
java·ide·intellij-idea
ShuiShenHuoLe1 天前
Visual Studio 2022 Community 下载指南
ide·visual studio
VIP_CQCRE1 天前
在 Visual Studio 中接入 Ace Data Cloud:让 LMLocal 直接调用 OpenAI 兼容模型
openai·ai编程·开发工具·visual studio·ace data cloud