gcc环境opengl编译出错 新手求教 拜托各位大大 10
#include<windows.h>#include<GL/glut.h>voidmyDisplay(void){glClear(GL_COLOR_BUFFER_BIT...
#include <windows.h>
#include <GL/glut.h>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("第一个OpenGL程序");
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
}
glut.h glut.lib glut32.lib glut.dll glut32.dll 无论放哪里都出错
# define GLUT_DISABLE_ATEXIT_HACK都试过
---------- gcc ----------
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xe): undefined
reference to `glClear@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x39): undefined reference to `glRectf@16'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x41): undefined reference to `glFlush@0'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x6b): undefined reference to `glutInit@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x7a): undefined reference to `glutInitDisplayMode@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x91): undefined reference to `glutInitWindowPosition@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xa8): undefined reference to `glutInitWindowSize@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xb7): undefined reference to `glutCreateWindow@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xc6): undefined reference to `glutDisplayFunc@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xce): undefined reference to `glutMainLoop@0'
collect2.exe: error: ld returned 1 exit status 展开
#include <GL/glut.h>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("第一个OpenGL程序");
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
}
glut.h glut.lib glut32.lib glut.dll glut32.dll 无论放哪里都出错
# define GLUT_DISABLE_ATEXIT_HACK都试过
---------- gcc ----------
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xe): undefined
reference to `glClear@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x39): undefined reference to `glRectf@16'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x41): undefined reference to `glFlush@0'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x6b): undefined reference to `glutInit@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x7a): undefined reference to `glutInitDisplayMode@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0x91): undefined reference to `glutInitWindowPosition@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xa8): undefined reference to `glutInitWindowSize@8'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xb7): undefined reference to `glutCreateWindow@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xc6): undefined reference to `glutDisplayFunc@4'
C:\Users\xiepai\AppData\Local\Temp\cck3Jz9b.o:opengl.c:(.text+0xce): undefined reference to `glutMainLoop@0'
collect2.exe: error: ld returned 1 exit status 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询