from: Lazy Foo'Productions - Setting up SDL 2 on Visual Studio 2010 Ultimate

1)First thing you need to do is download SDL 2 headers and binaries. You will find them on the SDL website, specifically on this page.

You'll want to download the visual c++ development libraries.

Open the zip archive and there should be a folder called SDL2-2.something.something. Copy the contents of the folder and put it anywhere you'd like. I recommend putting it in a folder that you dedicate to holding all your development libraries for Visual Studio. For these tutorials I'm putting them in a directory I created called C:\vs_dev_lib

2)Start up Visual Studio and create a new empty project.

3)Go to project properties.

4)Now we have to tell Visual C++ to search for header files in the SDL 2 include folder we just extracted. Under Configuration Properties in the VC++ Directories menu, select the Include Directories field, click the tiny down arrow button, and click edit.

5)Click the folder icon, and then click the button that pops up.

6)Now go find the SDL2 folders you extracted, and select the include folder and click OK.

Now Visual Studio knows where to find the header files. If you get an error that the compiler can't find SDL.h, it means you messed up this step.

7)Next we going to tell Visual C++ to search for library files in the SDL 2 library folder we just extracted. Select the Library Directories field, click the tiny down arrow button, and click edit.

8)Click the folder icon, and then click the button that pops up.

9)Now go find the lib folder you extracted, and select the lib folder where you find two folders. There's one for 32bit x86 architecture and for 64bit x64 architecture.

This is important: most compilers still compile 32bit binaries by default to maximize compatibility. We will be using the 32bit binaries for this tutorial set. It doesn't matter if you have a 64bit operating system, since we are compiling 32bit binaries we will be using the 32bit library. This means you need to select the x86 folder and click ok. Now Visual Studio knows where to find the library files. If you get an error how the linker can't find SDL2.lib, it means you missed this step.

10)In order to compile SDL code, we have to tell the Visual C++ to link against the libraries. Go under Linker in the Input menu, edit the additional dependencies.

11)Now paste

SDL2.lib;
SDL2main.lib;
into the Additional dependencies field and click OK.
Now Visual Studio knows to link against SDL 2. If you get a bunch of undefined reference error after compiling, it means you messed up this step.
 
12)Under Linker in the System menu, set the subsystem.
 
You can set it to Windows if you don't want console output, and Console if you do want console output. For this tutorial set, errors will be printed on the console, so I recommend leaving it as a console application as you are still learning and prototyping. If you get an error about an entry point not being defined or unresolved external symbol _main it means you skipped this step.
 
13)When our SDL 2 application runs, the operating system needs to be able to find the dll file.

Go find the SDL 2 lib folder you extracted and copy SDL2.dll and put it either your project's working directory (where the vcxproj file is at), or inside of the system directory. C:\WINDOWS\SYSTEM32 is the 32bit windows system directory and C:\Windows\SysWOW64 is the 64bit system directory of 32bit applications. For these tutorials, I'm assuming we're making 32bit applications.

 
14)Now go download the source for lesson 01. Add the source file inside to your project.

Now build. If there are any errors, make sure you didn't skip a step.

Now that you have SDL 2 compiling, it's time to go onto part 2 of the tutorial.

 

【转】Setting up SDL 2 on Visual Studio 2010 Ultimate的更多相关文章

  1. 【转】Setting up SDL Extension Libraries on Visual Studio 2010 Ultimate

    FROM:http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/windows ...

  2. 【转】Setting up SDL 2 on Visual Studio 2019 Community

    FROM: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvc2019/index.php Setting up SDL 2 on V ...

  3. Visual Studio 2010 简体中文旗舰、专业版(MSDN原版下载)

    Visual Studio 2010 简体中文旗舰.专业版(MSDN原版下载)(Visual Studio 2010 ultimate professional x86 dvd)2010[光盘镜像]- ...

  4. visual studio 2010 破解版 破解方法

    1.Microsoft Visual Studio 2010下载(均来自微软官网) 高级版(Premium) [建议下载]       http://download.microsoft.com/do ...

  5. 《转》Visual Studio 2010 终极定制安装精简方法

    打开VS2010安装目录下的 Setup 文件夹,找到 baseline.dat 文件和 vs_setup.pdi 文件还有一个 locdata.ini 文件,是对应的. 这些都是文本文件,用记事本就 ...

  6. Visual Studio 2010 更新NuGet Package Manager出错解决办法

    在Visual Studio 2010的扩展管理器中发现NuGet Package Manger有最新版本更新提示,选择更新安装提示以下错误信息: 2013/4/25 1:11:48 - Micros ...

  7. Visual Studio 2010下载 + 附破解方法

    Visual Studio 2010下载 + 附破解方法 1.Microsoft Visual Studio 2010下载 旗舰版(Ultimate) http://download.microsof ...

  8. SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发

    转:http://www.cnblogs.com/fatwhale/archive/2010/02/24/1672633.html 在Visual Studio 2010中,  已经集成了用于Shar ...

  9. Visual Studio 2010以及TeamFoundationServer 2010 MSDN免Key版地址分享(转载)

    以下链接转自互联网,已经下载验证SHA1码和MSDN公布的一致,跟我一样不喜欢下试用版再自己动手的同学,请使用最新版的BT工具或者迅雷下载(需要支持Magnet协议) Download Visual ...

随机推荐

  1. 菜鸟学python之大数据的初认识

    这次作业的要求来自于:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE1/homework/2639 1.这些分析所采用数据来源是什么? 国家数据库:中国铁路 ...

  2. CSS3旋转缩放移动倾斜等效果——transform

    1.transform浏览器支持情况 也就是说目前不考虑老浏览器的话是不用加前缀的,感谢菜鸟教程:https://www.runoob.com/cssref/css3-pr-transform.htm ...

  3. Laravel-任务调度

    简介Cron 是 UNIX.SOLARIS.LINUX 下的一个十分有用的工具,通过 Cron 脚本能使计划任务定期地在系统后台自动运行.这种计划任务在 UNIX.SOLARIS.LINUX下术语为 ...

  4. delphi7 编译的程序在win7下请求获得管理员权限的方法

    网上找到的,记下来方便查找,亲测此方法可用.附带把编译好的uac.res上传. 首先,用记事本新建一文本文档,内容如下: 1 24 UAC.manifest 然后另存为uac.rc 另外新建一文本档, ...

  5. html表单的方便操作

    //表单阻止复制粘贴 <input class="pass" type="text" oncopy="return false" on ...

  6. jQuery的事件处理

    一.页面加载响应事件 $(document).ready()方法,获取文档就绪的时候.他极大地提高了Web相应速度.虽然该方法可以代替传统的window.onload()方法,但是两者之间仍然有差别. ...

  7. Power BI For Competition

    It's traditional report design, I'm insufficient for designing that if had a designer to help me wil ...

  8. mysql优化 | 存储引擎,建表,索引,sql的优化建议

    个人对于选择存储引擎,建表,建索引,sql优化的一些总结,给读者提供一些参考意见 推荐访问我的个人网站,排版更好看: https://chenmingyu.top/mysql-optimize/ 存储 ...

  9. 阿里云ECS服务器部署Node.js项目全过程详解

    本文详细介绍如何部署NodeJS项目到阿里云ECS上,以及本人在部署过程中所遇到的问题.坑点和解决办法,可以说是全网最全最详细的教程了.同时讲解了如何申请阿里云免费SSL证书,以及一台ECS服务器配置 ...

  10. DirectX11 With Windows SDK--25 法线贴图

    前言 在很早之前的纹理映射中,纹理存放的元素是像素的颜色,通过纹理坐标映射到目标像素以获取其颜色.但是我们的法向量依然只是定义在顶点上,对于三角形面内一点的法向量,也只是通过比较简单的插值法计算出相应 ...