2

所以我知道,当文件没有正确链接时,通常会发生此错误。问题是我从一个文件中得到这个,其中声明了东西(没有与函数相关的外部文件,这都在一个文件中):

例如:

inline SDL_Surface *ImgLoader(char *file,bool bCKey, int r , int g , int b , int alpha)
{
    SDL_Surface *pic;
    pic = IMG_Load(file); // From SDL_image.h , load the image to pic
    if(pic==NULL) fprintf(stderr,"Missing image %s : %s\n",file,IMG_GetError());
    if( bCKey ) {
        SDL_SetColorKey(pic,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(pic->format,r,g,b));
        }
    if(alpha) SDL_SetAlpha(pic, SDL_SRCALPHA|SDL_RLEACCEL , 255 - alpha);
    pic = SDL_DisplayFormat(pic);
    return (pic);
}

它的用法:

anim[0] = ImgLoader("./anim/justice1.gif",1,255,255,255,230);

如果那里的声明为什么会发生这种情况?

编辑:对不起错误:

未定义对“ImgLoader”的引用

PS 我知道这与 SDL 有关,但我认为这更多的是与 C 相关的查询,而不是专门针对游戏的查询。

4

0 回答 0