sdl教程地址
https://lazyfoo.net/tutorials/SDL/index.php
新建C++项目(空项目)
新增src和include目录
新建main.cpp文件
main.cpp
#include <SDL/SDL.h>
#include <iostream>
int main(int argc, char* args[])
{
if (SDL_Init(SDL_INIT_EVERYTHING) == 0)
{
std::cout << "SDL initialized! Success " << "\n";
}
else
{
std::cout << "SDL could not be initialized! SDL_Error: " << SDL_GetError << "\n";
return 0;
}
SDL_Quit();
return 0;
}
调成x64
复制assets,lib,bin,sdl文件夹到项目相应目录下。
将SDL头文件和lib文件包含到项目中
项目属性设置:
include\SDL;$(ProjectDir)\include
PATH=bin$(LocalDebuggerEnvironment)
运行程序: