我有一個Linux的mingw32交叉編譯器,它在linux上編譯windows二進制文件。一切工作非常細,直到我需要安裝過剩......我在linux安裝了罰款,但每當我試圖在Windows上編譯同一個程序,我可以熬它歸結爲:如何在Linux上使用Windows交叉編譯器的glut?
/tmp/ccQhHDhy.o: 。main.cpp中:(文本+ 0xf):未定義參照
__imp__glClear' /tmp/ccQhHDhy.o:main.cpp:(.text+0x1e): undefined reference to
_ imp的 _glBegin' /tmp/ccQhHDhy.o:main.cpp:(.text+0x3d):未定義參照__imp__glVertex3f' /tmp/ccQhHDhy.o:main.cpp:(.text+0x5c): undefined reference to
_ imp的 _glVertex3f」 /tmp/ccQhHDhy.o:main.cpp:(.text+0x7b):undefined reference to__imp__glVertex3f' /tmp/ccQhHDhy.o:main.cpp:(.text+0x85): undefined reference to
_ imp _glEnd'
用的dll鏈接直接
獲得這些鏈接器錯誤後,我嘗試連接opengl32 GDI32 WINMM過剩LIB文件和glu32
,但仍然是相同的這
繼承人的源代碼:
#include <stdlib.h>
#include <GL/glut.h>
using namespace std;
void render(void);
int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitWindowPosition(-1,-1);
glutInitWindowSize(500,500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("My First Glut Application");
glutDisplayFunc(render);
glutMainLoop();
return 0;
}
void render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5, -0.5, 0.0);
glVertex3f(0.5, 0.0, 0.0);
glVertex3f(0.0, .5, 0.0);
glEnd();
}
在你的情況下,它沒有那麼多的源代碼,我們需要查看,但編譯器/鏈接器調用。 – datenwolf