Linux_Lyb This e-mail address is being protected from spambots. You need JavaScript enabled to view it http://linuxlyb.yeah.net
2004年7月21日
1. 下载 Dev-Cpp , SDL的运行库和SDL用于mingw32的开发者版本
Dev-Cpp: http://www.bloodshed.net/
sdl运行库: http://www.libsdl.org/release/SDL-1.2.7-win32.zip
mingw32的开发版本: http://www.libsdl.org/release/SDL-devel-1.2.7-mingw32.tar.gz
2. 复制SDL的运行库( SDL.dll )到系统目录下(例如:c:\windows\system32)。这样做使运行库
在系统范围可用。
3. 复制mingw32的开发包内的 SDL-1.x.x\include\SDL 整个文件夹到dev-cpp安装目录下的include
目录(例如:C:\Dev-Cpp\Include),这样使SDL的头文件在dev-cpp里可用。
4. 复制mingw32的开发包内 SDL-1.x.x\lib 文件夹的全部文件到到dev-cpp安装目录下的lib目录
(例如:C:\Dev-Cpp\lib) ,这样使SDL库对dev-cpp生效。
5. 创建一个新的Dev-Cpp工程,并加入程序文件到工程里面。
6. 点击菜单的“工程 -> 工程属性”,在“参数”的连接器编辑框输入
“-lmingw32 -lSDLmain -lSDL -mwindows”
7. 现在就能用dev-cpp就能编译,链接sdl程序了
附例程:
#include/* All SDL App's need this */ #include #include int main(int argc,char *argv[]) { printf("Initializing SDL.\n"); /* Initialize defaults, Video and Audio */ if((SDL_Init(SDL_INIT_VIDEO)==-1)) { printf("Could not initialize SDL: %s.\n", SDL_GetError()); exit(1); } printf("SDL initialized.\n"); printf("Quiting SDL.\n"); /* Shutdown all subsystems */ SDL_Quit(); printf("Quiting....\n"); exit(0); }
Bookmark
Email this
Hits: 7763
Comments (0)

Write comment



