2008年11月25日星期二

在Eclipse建立SDL Extension Libraries

在Eclipse建立SDL Extension Libraries (Setting up SDL Extension Libraries in Eclipse)
http://www.libsdl.org/下载 SDL Windows development library
每一个 extension libary 有三个主要部分:

1. The header file.
2. The lib file.
3. The *.dll file(s)

将 header file 存到 MinGW include folder. It should be at C:\MinGW\include\SDL.
将lib file 存到MinGW lib folder. The MinGW lib folder should be at C:\MinGW\lib.
再 提取 *.dll file(s) 到 C:\WINDOWS\SYSTEM32 (This is so whenever you make an SDL extension app, the program will be able to find the *.dll file(s) even if they're is not in the same directory as the *.exe)

但是存放.lib 和头文件的位置也不用和上面所说的一样,但是要记住放置的位置:)


SDL是用C编写的,但是也支持C++,同时其他多种语言,太好了,我们可以用自己熟悉的语言使用它。我在以后的实例中使用C++来使用它。

现在在Eclipse中进行一些设定:
properties --> C/C++ build --> Setting --> GCC Compiler --> Directories --> Include paths (-I) --> 加入所有需要的Include
properties --> C/C++ build --> Setting --> MinGW C Linker --> Libraries --> Include search path (-L) --> 加入所有需要的Library的Path --> 在Libraries (-I)里加入 mingw32 SDLmain SDL 请注意:要依次加入!!

linker的名称为 :
-lmingw32
-lSDLmain
-lSDL

另一个值得注意的点:#include 的写法,因为我在properties --> C/C++ build --> Setting --> GCC Compiler --> Directories --> Include paths 只写了例如:C:\SDL-devel-1.2.13-mingw32

如果使用的是Qt Eclipse Integration,就不需要进行以上操作,只需对.pro文档进行设定,在.pro文档中加入SDL的include和lib名称和路径。

没有评论: