LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 822|回复: 2

请问一个SDL问题:

[复制链接]
发表于 2004-5-20 17:08:57 | 显示全部楼层 |阅读模式
这是我的测试程序:

/*
* ball.c
*/

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<errno.h>
#include<sys/types.h>
#include"SDL/SDL.h"
#include"SDL/SDL_image.h"

int err_exit(const char* str);

int main(int argc,char* argv[]){
        SDL_Surface* screen;
        SDL_Surface* pic;
        SDL_Rect src,dest;
       
        if(SDL_Init(SDL_INIT_VIDEO)==-1)  //initializes the SDL
                err_exit(SDL_GetError());
        atexit(SDL_Quit);

        screen=SDL_SetVideoMode(800,600,24,0);
        if(screen==NULL)
                err_exit(SDL_GetError());
       
        pic=IMG_Load("image/pic.jpg");
        if(pic==NULL)
                err_exit(SDL_GetError());

        dest.x=0;
        dest.y=0;
        dest.w=pic->w;
        dest.h=pic->h;
        SDL_BlitSurface(pic,NULL,screen,&dest);
        SDL_UpdateRects(screen,1,&dest);


        SDL_UpdateRect(screen,0,0,0,0);
        SDL_FreeSurface(pic);
        SDL_Delay(5000);
        return 0;       

}

int  err_exit(const char* str){
        fprintf(stderr,"%s",str);
        if(errno!=0)
                fprintf(stderr,":%d",errno);
        exit(1);
}

用 gcc *.c `sdl-config --cflags --libs` -ISDL_image 编译后
出现如下错误:

/tmp/ccqeIWnS.o(.text+0x88): In function `main':
: undefined reference to `IMG_Load'
collect2: ld returned 1 exit status


这是怎么回事啊?
是不是编译命令的参数不对啊!
谢谢指教!
发表于 2004-5-20 20:53:10 | 显示全部楼层
应该是-lSDL_image,不是I(大写的i),是l(小写的el)
发表于 2005-3-16 16:32:15 | 显示全部楼层
请问如何删除 SDL 呀
  我是用rpm包安装的    不只道怎么删除了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表