【转】Setting up SDL Extension Libraries on MinGW
FROM:http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/windows/mingw/index.php
Setting up SDL Extension Libraries on MinGW
Last Updated 6/21/14
1)First thing you need to do is download SDL_image headers and binaries. You will find them on the SDL_image website, specifically on this page.
You'll want to download the MinGW development libraries.
Open the gzip archive and there should be a tar archive. Open up the tar archive and the should be a folder called SDL2_image-2.something.something. In side of that folder there should be a bunch of folders and files, most importantly i686-w64-mingw32 which contains the 32bit library and x86_64-w64-mingw32 which contains the 64bit library.
2)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.
Inside of i686-w64-mingw32 are the include, lib, and bin folders which contain everything we need compile and run SDL applications. Copy the contents of i686-w64-mingw32 to any directory you want. I recommend putting it in a folder that you dedicate to holding all your development libraries for MinGW. For these tutorials I'm putting it in a directory I created C:\mingw_dev_lib
3)Now go download the source for lesson 06. Extract the source somewhere and compile by entering this big old command (This command assumed you have SDL_image extracted at C:\mingw_dev_lib):
g++ 06_extension_libraries_and_loading_other_image_formats.cpp -IC:\mingw_dev_lib\include\SDL2 -LC:\mingw_dev_lib\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -o 06_extension_libraries_and_loading_other_image_formats
If you're using a makefile, you can just change the values of some of the macros:
From Makefile
#OBJS specifies which files to compile as part of the project
OBJS = 06_extension_libraries_and_loading_other_image_formats.cpp #CC specifies which compiler we're using
CC = g++ #INCLUDE_PATHS specifies the additional include paths we'll need
INCLUDE_PATHS = -IC:\mingw_dev_lib\include\SDL2 #LIBRARY_PATHS specifies the additional library paths we'll need
LIBRARY_PATHS = -LC:\mingw_dev_lib\lib #COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
# -Wl,-subsystem,windows gets rid of the console window
COMPILER_FLAGS = -w -Wl,-subsystem,windows #LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lmingw32 -lSDL2main -lSDL2 -lSDL2_image #OBJ_NAME specifies the name of our exectuable
OBJ_NAME = 06_extension_libraries_and_loading_other_image_formats #This is the target that compiles our executable
all : $(OBJS)
$(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)
As you can see it was as easy as changing the file name of the source and executable and adding
-lSDL2_image
to the linker. If we were linking SDL_ttf, we'd add
-lSDL2_ttf
and for SDL_mixer we'd put:
-lSDL2_mixer
Now that you have the extension library compiling, it's time to go onto part 2 of the tutorial.
【转】Setting up SDL Extension Libraries on MinGW的更多相关文章
- 【转】Setting up SDL Extension Libraries on Code::Blocks 12.11
FROM: http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/window ...
- 【转】Setting up SDL Extension Libraries on Windows
FROM: http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/window ...
- 【转】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 ...
- 【转】Setting up SDL Extension Libraries on Visual Studio 2019 Community
FROM:http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/windows ...
- 【转】Extension Libraries and Loading Other Image Formats
FROM: http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/index. ...
- 【转】Setting up SDL 2 on MinGW
FROM: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/mingw/index.php Setting up SDL 2 on MinG ...
- 【转】Setting up SDL 2 on Code::Blocks 12.11
FROM: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php Setting up SDL 2 on ...
- 【转】Setting up SDL 2 on Visual Studio 2010 Ultimate
from: Lazy Foo'Productions - Setting up SDL 2 on Visual Studio 2010 Ultimate 1)First thing you need ...
- 【转】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 ...
随机推荐
- 刷题[HFCTF2020]EasyLogin
前置知识 node.js koa框架常用目录,文件 js弱类型语言,空数组与整数1比较时,返回turue jwt令牌 博客讲解: 关于jwt的讲解: http://www.ruanyifeng.com ...
- application x-www-form-urlencoded与JS的encodeURIComponent()
application/x-www-form-urlencoded 表单的enctype属性表示在发送到服务器之前应该如何对表单数据进行编码,默认值是application/x-www-form-ur ...
- React学习小记--setState的同步与异步
react中,state不能直接修改,而是需要使用setState()来对state进行修改,那什么时候是同步而什么时候是异步呢? 基础代码: setCounter = (v) => { thi ...
- 神奇的字符串匹配:扩展KMP算法
引言 一个算是冷门的算法(在竞赛上),不过其算法思想值得深究. 前置知识 kmp的算法思想,具体可以参考 → Click here trie树(字典树). 正文 问题定义:给定两个字符串 S 和 T( ...
- 04 Storage and Calculation C语言中的存储和计算
文章内容来源于Programming Hub的学习记录,本人整理添加了中文翻译,如有侵权,联系本人删除 Variables C语言中的变量 Let's extend our mainfunction ...
- 给Python IDLE添加行号显示
转载:https://blog.csdn.net/howard2005/article/details/104112297 文章目录一.引出问题1.Spyder编辑Python程序能显示行号2.Pyt ...
- MyEclipse 设置打开 jsp 文件的默认编辑器
MyEclipse 版本信息 MyEclipse Enterprise Workbench Version: 2014 Build id: 12.0.0-20131202 菜单 Window > ...
- 【题解】SP1812 【LCS2 - Longest Common Substring II 】
\(\text{Suffix Tree:}\)我来啦我来啦 \(\text{Solution:}\) 题目要求求好几个串串的\(\text{LCS.}\) 由于串串的数量并不多,所以我们把它们塞到一个 ...
- cocos creator屏幕适配的一些知识点
一. cocos creator 提供的几种适配策略 EXACT_FIT: 整个应用程序在指定区域可见,无需尝试保留原始纵横比.可能会出现失真,应用程序会被拉伸或压缩.也就是说设计分辨率的长和宽不会等 ...
- 网站搭建-云服务器ECS的使用
1. 查看购买的云服务器实例,重置密码 2. 查找IP进行查看,此时网页时不存在的,开始配置: 3. 登录putty或其他终端,进行网页搭建,先按教程走一遍,然后再做个性化处理: #安装Apache ...