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

这样就是成功了!!!

相关推荐
liufeiyu19764 小时前
VS 2026 升级后出现错误: 找不到指定的 SDK“Microsoft.NET.Sdk”
visual studio·vs 2026
霍霍的袁5 小时前
【C++】map 和 set 的使用 | 从用法到底层
开发语言·c++·学习·visual studio
2501_9159090610 小时前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
2501_915918411 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
VIP_CQCRE1 天前
在 Visual Studio 里接入 Ace Data Cloud:让 AI 编程助手直接用上 OpenAI 兼容接口
openai·ai编程·开发工具·visual studio·acedatacloud
VIP_CQCRE1 天前
在 Visual Studio 里接入 AI 编程助手:用 Ace Data Cloud 打通 OpenAI 兼容接口与 LMLocal
openai·ai编程·visual studio·acedatacloud·lmlocal
free-elcmacom1 天前
发际线警告!手撕《C陷阱与缺陷》终极 BOSS:signal 函数与 typedef 魔法
c语言·开发语言·visual studio code·visual studio
VIP_CQCRE1 天前
Visual Studio 也能丝滑接入大模型:用 Ace Data Cloud + LMLocal 打造 AI 编程体验
ai·大模型·visual studio·ace data cloud·lmlocal
千谦阙听1 天前
【 C++篇】:模板初阶——泛型编程、函数模板与类模板
开发语言·c++·学习·visual studio
滕州市燕猫虎计算机科技工作室个体工商户2 天前
IDEA:Command line is too long
java·ide·intellij-idea