Im using SDL2 to do all my image rendering, screen creation, basically what it's used for. I'm near the end of finishing up, and I wanted to test my image loading function, The test ended in a failure. I have been trying to solve this problem for little over two hours now, and I am making no progress. this is my error.
Error 1 error LNK2019: unresolved external symbol _IMG_LoadTexture referenced in function "public: __thiscall CSprite::CSprite(struct SDL_Renderer *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int)" (??0CSprite@@QAE@PAUSDL_Renderer@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHH@Z) z:\my documents\visual studio 2013\Projects\SDL tuts 1\SDL tuts 1\Sprite.obj SDL tuts 1
here is the class, and the header file.
#include "Sprite.h"
#include "includes.h"
CSprite::CSprite(SDL_Renderer *passedrenderer, std::string Filepath, int x, int y, int w, int h)
{
renderer = passedrenderer;
image = NULL;
image = IMG_LoadTexture(renderer, Filepath.c_str());
rect.x = x;
rect.y = y;
rect.w = w;
rect.h = h;
}
CSprite::~CSprite()
{
SDL_DestroyTexture(image);
}
void CSprite::Draw()
{
SDL_RenderCopy(renderer, image, NULL, &rect);
}
#pragma once
#include "includes.h"
class CSprite
{
public:
CSprite(SDL_Renderer *passedrenderer,std::string Filepath, int x, int y, int w, int h);
~CSprite();
void Draw();
private:
SDL_Texture *image;
SDL_Rect rect;
SDL_Renderer *renderer;
};
If you need anything else, Im more than willing to give the needed resources.