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

这样就是成功了!!!

相关推荐
蜕变的土豆6 小时前
Visual Studio编译器调试信息格式详解:PDB文件的重要性与发布环境配置指南
visual studio
Luoxi_88 小时前
Anaconda超详细的安装教程+VScode的使用
ide·vscode·编辑器
球king10 小时前
CC GUI 插件:在 IDEA 中使用 CodeX
java·ide·intellij-idea
大龄牛码11 小时前
从模型基座到工程范式:GPT-5.6与Grok 4.5在主流AI IDE中的架构适配与选型分析
ide·人工智能·gpt
不负信仰12 小时前
Visual Studio 三月更新 —— 打造专属自定义 Agent
ide·visual studio
祸心依旧12 小时前
Visual Studio 五月更新 —— 计划、评审、优化
运维·人工智能·visual studio
慕容引刀15 小时前
告别Commit信息纠结:使用Git AI Commit插件实现规范化提交
人工智能·git·github·visual studio code·visual studio
流量猎手15 小时前
Vscode登陆服务器
服务器·ide·vscode
HAPPY酷15 小时前
【ROS2】16G 内存笔记本跑 ROS2 仿真?VMware 虚拟机“保姆级”配置指南 (R9 7940HX + RTX 4060)
java·linux·ide·windows·pycharm
烽火聊员1 天前
查看Android Studio错误日志
android·ide·android studio