Pages : 1
#1 Le 02/07/2007, à 21:40
- antoinexp
compiler pour windows avec mingw32
Bonjour,
Je souhaite pouvoir compiler mes programmes directements pour windows sur linux,
J'ai donc installer mingw32, mais voila, je n'arrive pas à compiler des programmes avec des bibliothèques comme la SDL !
Prenons un exemple simple :
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 17, 206, 112));
SDL_Flip(ecran);
while(1)
{
SDL_WaitEvent(&event);
if(event.type == SDL_QUIT) break;
}
SDL_Quit();
return EXIT_SUCCESS;
}
Je compile dans la console :
22:37:56 antoinexp@antoinexp-laptop ~$ i586-mingw32msvc-gcc-3.4.5 -lSDL -lSDLmain main.c -o programme.exe
/tmp/ccyOpI5D.o:main.c:(.text+0x13): référence indéfinie vers « _SDL_Init »
/tmp/ccyOpI5D.o:main.c:(.text+0x29): référence indéfinie vers « _SDL_SetVideoMode »
/tmp/ccyOpI5D.o:main.c:(.text+0x49): référence indéfinie vers « _SDL_MapRGB »
/tmp/ccyOpI5D.o:main.c:(.text+0x57): référence indéfinie vers « _SDL_FillRect »
/tmp/ccyOpI5D.o:main.c:(.text+0x65): référence indéfinie vers « _SDL_Flip »
/tmp/ccyOpI5D.o:main.c:(.text+0x74): référence indéfinie vers « _SDL_WaitEvent »
/tmp/ccyOpI5D.o:main.c:(.text+0x82): référence indéfinie vers « _SDL_Quit »
/usr/lib/gcc/i586-mingw32msvc/3.4.5/../../../../i586-mingw32msvc/lib/libmingw32.a(main.o): référence indéfinie vers « _WinMain@16 »
collect2: ld returned 1 exit status
Que dois-je faire ?
Hors ligne
#2 Le 04/07/2007, à 21:42
- antoinexp
Re : compiler pour windows avec mingw32
Cay bon, il faut en faite mettre sdlmain avant sdl !
Hors ligne