07/05/17 10:27:09
WindowsXPにMingw+MSYSでプログラミングしています。
Mesa-6.5.3とglut-3.7.6をmakeし、/mingw/include /mingw/libに
ヘッダファイルとライブラリをコピーし次のサンプルプログラム
をコンパイルしたところlinkerエラーになってしまいます。
#include <GL/glut.h>
void display(void) { }
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutCreateWindow(argv[0]);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
$ gcc -o test.exe test.c -lglut32 -lopengl32 -L/mingw/lib
C:/(hoge)/Temp/ccG2baaa.o:test.c:(.text+0x1c): undefined reference to `__glutInitWithExit'
C:/(hoge)/Temp/ccG2baaa.o:test.c:(.text+0x37): undefined reference to `__glutCreateWindowWithExit'
C:/(hoge)/Temp/ccG2baaa.o:test.c:(.text+0x52): undefined reference to `__glutCreateMenuWithExit'
C:/(hoge)/Temp/ccG2baaa.o:test.c:(.text+0xae): undefined reference to `glutDisplayFunc'
C:/(hoge)/Temp/ccG2baaa.o:test.c:(.text+0xb3): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
リンカーがlibglut32.aを見つけられてないような気がしるのですが、
ライブラリをコピーするだけではだめなのでしょうか。