我在Ubuntu 11.04上编写了一个使用freeglut的程序。它运行良好。然后我又购买了另一台电脑,并尝试在新安装的Ubuntu 11.04上运行该程序。不起作用。所以我安装Opengl linux未定义的基本功能参考
sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu
1台面-dev的填实libgl1台面-GLX填实libgl1台面-dev的台面,共开发GCC
,并试图运行该程序,其中进口
#include <GL/freeglut.h>
#include <GL/gl.h>
#include <GL/glu.h>
使用命令
g++ -lGL -lGLU -lglut Driver.cpp -o a
然而接头或任何吐出等的形式的200个错误:
Driver.cpp:(.text+0x3c6b): undefined reference to `glutSolidSphere'
Driver.cpp:(.text+0x3c75): undefined reference to `glEnable'
Driver.cpp:(.text+0x3c9a): undefined reference to `glColor4f'
Driver.cpp:(.text+0x3cb5): undefined reference to `glRotatef'
Driver.cpp:(.text+0x3d02): undefined reference to `glutSolidSphere'
Driver.cpp:(.text+0x3d07): undefined reference to `glutSwapBuffers'
问题的原因是什么?
如果您使用gcc进行编译,为什么您的源文件被命名为.cpp?如果是C++,则必须使用g ++进行编译,如果是C,则必须调用something.c。 – lvella 2012-04-03 20:32:55
错误发布。我正在使用g ++ – 2012-04-03 20:34:55
这是什么Driver.cpp?你是否从program.cpp中包含它? – lvella 2012-04-03 20:35:50