Alors voilà un partie du code :
Dans Personnage.h :
#ifndef PERSONNAGE_H_INCLUDED
#define PERSONNAGE_H_INCLUDED
class Personnage
{
public :
Personnage();
Personnage(SDL_Surface *personnage, SDL_Rect positionPersonnage);
void afficher(SDL_Surface *surface);
void lancer();
private :
SDL_Surface *m_personnage;
SDL_Rect m_positionPersonnage;
};
#endif // PERSONNAGE_H_INCLUDED
Dans Personnage.cpp :
#include<iostream>
#include<SDL/SDL.h>
#include<SDL_image.h>
#include<Personnage.h>
Personnage::Personnage()
{
*m_personnage = NULL;
m_positionPersonnage.x = 0;
m_positionPersonnage.y = 0;
}
Personnage::Personnage(SDL_Surface *personnage, SDL_Rect positionPersonnage)
{
*m_personnage = *personnage;
m_positionPersonnage.x = positionPersonnage.x;
m_positionPersonnage.y = positionPersonnage.y;
}
Personnage::afficher(SDL_Surface surface)
{
SDL_BlitSurface(m_personnage, NULL, surface, &m_positionPersonnage);
}
Et l'endroit où je déclare ma déclaration de class :
while(menu_extra_kuruFries)
{
SDL_WaitEvent(&event);
if(kuruFries_declarationVariables)
{
SDL_Surface *kuruFries_kurutchin = SDL_LoadBMP("Data\\Images\\KuruFries\\image_kurutchin.bmp");
SDL_Rect positionKuruFries_kurutchin;
kuruFries_imageDeDebut = SDL_LoadBMP("Data\\Images\\KuruFries\\image_debut.bmp");
Personnage Kurutchin; // ça bug ici
kuruFries_declarationVariables = false;
}
Et ça m'affiche :
||=== Projet 1, Debug ===|
main.cpp|411|undefined reference to `Personnage::Personnage()'|
main.cpp|442|undefined reference to `Personnage::Personnage()'|
main.cpp|443|undefined reference to `Personnage::afficher(SDL_Surface*)'|
||=== Build finished: 3 errors, 0 warnings ===|