C++ eclipsec++;SDL_图像库不工作

C++ eclipsec++;SDL_图像库不工作,c++,eclipse,sdl-2,C++,Eclipse,Sdl 2,这是我的密码 #ifndef LOADBMP_H_ #define LOADBMP_H_ #include "SDL2/SDL.h" #include "res_path.h" #include "SDL2/SDL_image.h" SDL_Texture* loadTexture(const std::string &file, SDL_Renderer *ren) { SDL_Texture *texture = IMG_LoadTexture(ren, file.c_s

这是我的密码

#ifndef LOADBMP_H_
#define LOADBMP_H_

#include "SDL2/SDL.h"
#include "res_path.h"
#include "SDL2/SDL_image.h"
SDL_Texture* loadTexture(const std::string &file, SDL_Renderer *ren) 
{
    SDL_Texture *texture = IMG_LoadTexture(ren, file.c_str()); <-- troublesome line
    if (texture == NULL)
    {
        logSDLError(std::cout, "LoadTexture");
    }
    return texture;
}

#endif /* LOADBMP_H_ */
\ifndef LOADBMP\u H_
#定义LOADBMP\u H_
#包括“SDL2/SDL.h”
#包括“res_path.h”
#包括“SDL2/SDL_image.h”
SDL_纹理*加载纹理(常量std::字符串和文件,SDL_渲染器*ren)
{

SDL_Texture*Texture=IMG_LoadTexture(ren,file.c_str());如果已正确安装,则可能未正确链接。您需要以与SDL2和SDL2_main相同的方式链接库

例如,在下图中,您将向其添加SDL2_映像(这是Windows,但同样适用于Eclipse上的其他平台)


谢谢!原来我链接的是SDL\U图像,而不是SDL2\U图像。