
用dev c++配置SDL时的问题 5
配置好了运行这个程序有错误#include"stdio.h"#include"stdlib.h"#include"string.h"#include<SDL/SDL.h>...
配置好了 运行这个程序 有错误
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include <SDL/SDL.h>
#include "windows.h"
SDL_Surface *screen = NULL; //屏幕接口
int main( int argc, char* args[] ) //主程序
{
char msg[500]; // 得到系统消息
int done;
/* 初始化SDL */
if (SDL_Init (SDL_INIT_VIDEO) < 0)
{
sprintf (msg, "不能初始化 SDL: %sn", SDL_GetError ());
MessageBox (0, msg, "Error", MB_ICONHAND);
exit (1);
}
atexit (SDL_Quit);
/* 设置 640x480 16-bits 图象模式 */
screen = SDL_SetVideoMode (640, 480, 16, SDL_SWSURFACE | SDL_DOUBLEBUF);
if (screen == NULL)
{
sprintf (msg, "不能设置成 640x480x16 图象模式: %sn",
SDL_GetError ());
MessageBox (0, msg, "Error", MB_ICONHAND);
exit (2);
}
/*设置SDL窗口标题 */
SDL_WM_SetCaption ("hello,the world", NULL);
done = 0;
//游戏循环 done=1时退出,done=0时继续
while (!done)
{
SDL_Event event;
/* Check for events */
while (SDL_PollEvent (&event))
{
switch (event.type)
{
case SDL_KEYDOWN:
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
}
SDL_Quit();
return 0;
} 展开
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include <SDL/SDL.h>
#include "windows.h"
SDL_Surface *screen = NULL; //屏幕接口
int main( int argc, char* args[] ) //主程序
{
char msg[500]; // 得到系统消息
int done;
/* 初始化SDL */
if (SDL_Init (SDL_INIT_VIDEO) < 0)
{
sprintf (msg, "不能初始化 SDL: %sn", SDL_GetError ());
MessageBox (0, msg, "Error", MB_ICONHAND);
exit (1);
}
atexit (SDL_Quit);
/* 设置 640x480 16-bits 图象模式 */
screen = SDL_SetVideoMode (640, 480, 16, SDL_SWSURFACE | SDL_DOUBLEBUF);
if (screen == NULL)
{
sprintf (msg, "不能设置成 640x480x16 图象模式: %sn",
SDL_GetError ());
MessageBox (0, msg, "Error", MB_ICONHAND);
exit (2);
}
/*设置SDL窗口标题 */
SDL_WM_SetCaption ("hello,the world", NULL);
done = 0;
//游戏循环 done=1时退出,done=0时继续
while (!done)
{
SDL_Event event;
/* Check for events */
while (SDL_PollEvent (&event))
{
switch (event.type)
{
case SDL_KEYDOWN:
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
}
SDL_Quit();
return 0;
} 展开
1个回答
展开全部
工程属性-> 文件/目录 -> 库目录,添加 libSDL.a所在的路径
工程属性-> 参数 -> 链接器,添加参数 -lmingw32 -lSDLmain -lSDL -mwindows
拷贝SDL.dll到项目生成的exe路径下。
工程属性-> 参数 -> 链接器,添加参数 -lmingw32 -lSDLmain -lSDL -mwindows
拷贝SDL.dll到项目生成的exe路径下。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询