ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 概述 今天在github上找到了《仙剑奇侠传》的rpg单机游戏`sdlpal`,`sdlpal` 是一个开源项目,基于` sdl `把仙剑奇侠传重写了一遍。 下面是我的编译过程总结。 ## 环境 * win10 * sdl1.2 * sdlpal * vs2017 * DirectX SDK10 下载`sdlpal` ``` $ git clone https://github.com.cnpmjs.org/sdlpal/sdlpal.git ``` 下载`sdl1.2` ``` $ git clone https://github.com.cnpmjs.org/libsdl-org/SDL-1.2.git sdlpal/3rd/SDL/ ``` 下载 [DirectX SDK10](https://www.microsoft.com/zh-CN/download/confirmation.aspx?id=6812), 双击安装即可 ## 编译sdlpal 打开解决方案: `sdlpal\win32\sdlpal.sln` sdl解决方案右键属性,附加依赖项加入如下内容 ``` d3d8.lib dxerr8.lib uuid.lib dxguid.lib dinput8.lib d3dxof.lib ``` 否则会出现如下错误 ``` 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_RzAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_RyAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_RxAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_ZAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_YAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_XAxis 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_Key 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_IID\_IDirectDrawSurface3 1>sdl.lib(SDL\_dx5yuv.obj) : error LNK2001: 无法解析的外部符号 \_IID\_IDirectDrawSurface3 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_IID\_IDirectDraw2 1>sdl.lib(SDL\_dx5video.obj) : error LNK2001: 无法解析的外部符号 \_IID\_IDirectDrawGammaControl 1>sdl.lib(SDL\_dx5events.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_SysMouse 1>sdl.lib(SDL\_dx5events.obj) : error LNK2001: 无法解析的外部符号 \_GUID\_SysKeyboard 1>sdl.lib(SDL\_dx5events.obj) : error LNK2001: 无法解析的外部符号 \_IID\_IDirectInputDevice2A 1>.\\Release\\sdlpal.exe : fatal error LNK1120: 15 个无法解析的外部命令 ``` ## 运行sdlpal 编译出可执行文件`sdlpal.exe`,运行发现需要资源文件。 下载资源文件 ``` git clone https://github.com.cnpmjs.org/paldn/sdlpal.git DATA ``` 资源文件在`DATA/Data`目录下,运行程序,需要指定资源文件。 >`sdlpal`配置文件和可执行文件在同级目录:`sdlpal.cfg`