无法与mingw交叉编译opengl程序

时间:2017-08-21 13:36:40

标签: c++ opengl g++ mingw cross-compiling

我想从debian编译windows程序

> '/opt/mingw32/bin/i686-w64-mingw32-g++' '/home/redrockfish/Projects/OpenGl0/main.cpp' -o arcanoid.exe -static-libstdc++ -static-libgcc -lglu32 -lopengl32 -lglut32

/tmp/ccrvQIKM.o:main.cpp:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
/tmp/ccrvQIKM.o:main.cpp:(.text+0x3e): undefined reference to `_imp____glutCreateWindowWithExit@8'
/tmp/ccrvQIKM.o:main.cpp:(.text+0x60): undefined reference to `_imp____glutCreateMenuWithExit@8'
/opt/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.0/../../../../i686-w64-mingw32/bin/ld: /tmp/ccrvQIKM.o: bad reloc address 0x0 in section `.ctors'
collect2: error: ld returned 1 exit status

如果删除-lglut32,则未定义引用的数量会增加。标题如果freeglut.h,取自官方网站。将glut32替换为过剩,添加-lGLU并没有帮助。使用-lGL

cannot find -lGL
collect2: error: ld returned 1 exit status

1 个答案:

答案 0 :(得分:0)

__glutCreateWindowWithExit等功能不属于官方GLUT API。实际上,该函数是freeglut(甚至不是其外部API的一部分)所做的扩展,所以你不能链接一些随机的GLUT DLL,而是一个freeglut(可用于windows)。

相关问题