toge's diary

コンピュータ関連の趣味をつらつらと。

MinGW cross compiling environment

昨日の続き。果たして、コンパイル・実行できるのかと。

やっぱり最初はSDL testspriteでしょと。(MINGW_ROOTは適当に決めてください。)

> $MINGW_ROOT/usr/bin/i386-mingw32msvc-gcc testsprite.c -o testsprite `$MINGW_ROOT/usr/i386-mingw32msvc/bin/sdl-config --libs --cflags`
> wine testsprite.exe

あっさり動いてビックリ。

Linuxな世界なので、コンパイラに渡す順番がとっても重要。
次見たいに順番変えるだけでもう動かない。

> $MINGW_ROOT/usr/bin/i386-mingw32msvc-gcc `$MINGW_ROOT/usr/i386-mingw32msvc/bin/sdl-config --libs --cflags` testsprite.c -o testsprite 
/tmp/ccEUjocw.o:testsprite.c:(.text+0x36): undefined reference to `_SDL_LoadBMP_RW'
collect2: ld returned 1 exit status

なんか中身を見ていると、クロスコンパイラな人々は、本環境とかぶらないようにだいぶ工夫しているんだなぁと感心する。