Pointeur de structure en C

Bonjour,

Jai un gros problème avec un pointeur de structure en C!!!

voila ma structure située dans le main.cpp

struct global
{
HWND hwnd;

SDL_Surface* ecran;

SDL_Rect positionFenetre;

int ScreenX, ScreenY, FenX, FenY;
}global;

Je souhaite envoyer un pointeur de cette structure a parametres.cpp a la fonction

BOOL mainparametres(struct global *global)
{

initialisationparam();

SDL_Flip(global->ecran);

}
Que j'appelle comme ceci

mainparametres(&global);

Mais lors de la compilation codeblocks me dis "undefined type 'struct global'

Je deviens fou!!! SOS



Beh teh

2 réponses

  • Votes
  • Date
  • Date décroissante
  1. Contributeur
    typedef struct _SGlobal
    {
    	HWND hwnd;
    	SDL_Surface* ecran;
    	SDL_Rect positionFenetre;
    	int ScreenX, ScreenY, FenX, FenY;
    } SGlobal;
    
    BOOL mainparametres(SGlobal *global)
    {
    	initialisationparam();
    	SDL_Flip(global->ecran);
    }
    1. Sa marche paaaas!
      1. Contributeur
        Réponse inutile si tu décris pas l'erreur ...