【转】Setting up SDL Extension Libraries on Code::Blocks 12.11
Setting up SDL Extension Libraries on Code::Blocks 12.11
Last Updated 11/18/13
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.
Since Code::Blocks comes with the MinGW compiler by default, odds are 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)Open up your SDL 2 project and go to project properties.

4)Now we have to tell Code::Blocks to search for header files in the library folder we just extracted. Go to build options.

In the Search Directories, we need to add a new compiler directory. Click add, Select the SDL_image folder inside of the include directory from the folder we extracted. Say no when it asks you whether you want it to be a relative path. Now Code::Blocks knows where to find the SDL_image header files.

If you get an error where the compiler says it can't find SDL.h, it means you messed up this step.
You may have noticed that the folder added here is the same as the one for the SDL 2 main set up. Personally, I like keeping the SDL_image, SDL_ttf, and SDL_mixer headers and libraries in the same directories. Other people like to keep them separate. If you put the extension libary headers in the same directories as SDL 2, you can skip this step since you already told the compiler to look in that directory. If you put them somewhere else, you have to do this step so your compiler will look for the extension library headers in the right directory.
5)Next we are going to tell Code::Blocks to search for library files in the SDL folder we just extracted. All you have to is go to the linker tab and add the lib directory from the folder we extacted to the linker search directories.

If you get an error where the linker complains it can't find -lSDL2_image (or -lSDL2_ttf/-lSDL2_mixer), it means you messed up this step.
As with before, if you put the library files for the extension library in the same directory as SDL 2, you can skip this step since the compiler is already looking in that directory.
6)In order to compile SDL 2 code, we have to tell the compiler to link against the libraries. Go under Linker Settings and paste
-lSDL2_image
If you get an error where the linker complains about a bunch of undefined references, it means you messed up this step.
7)Like with plain SDL, the operating system needs to be able to find the dll files for the extension library while running.
Go find the SDL 2 folder you extracted and from the bin folder inside copy the dll files (all of them if there's more than one) and put it either where your executable will run, 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. If you get an error when you run the program where it complains that it can't find dll files, it means you messed up this step.
8)>Now go download the source for lesson 06. 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 the extension library compiling, it's time to go onto part 2 of the tutorial.
【转】Setting up SDL Extension Libraries on Code::Blocks 12.11的更多相关文章
- 【转】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 ...
- 【转】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 MinGW
FROM:http://lazyfoo.net/tutorials/SDL/06_extension_libraries_and_loading_other_image_formats/windows ...
- 【转】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 on Windows
FROM: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/index.php Setting up SDL on Windows Last ...
- Code::Blocks
Code::Blocks 是一个开放源码的全功能的跨平台C/C++集成开发环境. Code::Blocks是开放源码软件.Code::Blocks由纯粹的C++语言开发完成,它使用了著名的图形界面库w ...
- 【转】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 ...
随机推荐
- python ---倒酒!!
#!/usr/bin/env python3# -*- coding: utf-8 -*-import numbersimport numpyimport math'''三个容器分别为12升.8升.5 ...
- Harbor介绍与企业级私有Docker镜像仓库搭建
Harbor介绍与安装部署,并实现通过http和https协议[自签发SSL证书]访问,客户端如何通过Harbor镜像仓库实现镜像的上传[推送]与下载[拉取]. Harbor介绍 Harbor,是一个 ...
- 如何将炫酷的报表直接截图发送邮件——在Superset 0.37使用Schedule Email功能
Superset的图表是非常炫酷的,但是原来的版本只能在web端查看,而最新的0.37版本,可以将图表截图直接发送成邮件,非常的方便. 本文将详细介绍Superset 0.37 定时邮件功能.安装过程 ...
- Spark 模型选择和调参
Spark - ML Tuning 官方文档:https://spark.apache.org/docs/2.2.0/ml-tuning.html 这一章节主要讲述如何通过使用MLlib的工具来调试模 ...
- spring cloud gateway(三、实现限流)
限流一般有两个实现方式,令牌桶和漏桶 金牌桶是初始化令牌(容器)的个数,通过拿走里边的令牌就能通过, 没有令牌不能报错,可以设置向容器中增加令牌的速度和最大个数 漏桶是向里边放入请求,当请求数量达到最 ...
- (转载)什么是B+树?
本文转载自网络. 如有侵权,请联系处理!
- eclipse validating 卡着一直不动
处理方式: 1.对项目的.project文件去掉下面两个配置 org.eclipse.wst.jsdt.core.javascriptValidator 和 org.eclipse.wst.jsdt. ...
- Linux系统编程 —线程属性
在之前的章节中,我们在调用pthread_create函数创建线程时,第二个参数(即线程属性)都是设为NULL,即使用默认属性.一般情况下,使用默认属性已经可以解决我们开发过程中的大多数问题. 但是, ...
- CF600E Lomsat gelral 树上启发式合并
题目描述 有一棵 \(n\) 个结点的以 \(1\) 号结点为根的有根树. 每个结点都有一个颜色,颜色是以编号表示的, \(i\) 号结点的颜色编号为 \(c_i\). 如果一种颜色在以 \(x\) ...
- Jetson AGX Xavier/Ubuntu安装QT
安装QT命令 sudo apt-get install qt5-default qtcreator -y 如果出现错误:unknow module webenginewidgets serialpor ...