I wrote a program on Ubuntu 11.04 that uses freeglut. It worked fine. Then I got another computer and tried to run the program on a fresh install of Ubuntu 11.04. Doesn't work. So I installed
sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev mesa-common-dev gcc
and tried to run the program, which imports
#include <GL/freeglut.h>
#include <GL/gl.h>
#include <GL/glu.h>
using the command
g++ -lGL -lGLU -lglut Driver.cpp -o a
However the linker or whatever spits out like 200 errors of the form:
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'
What is the cause of the problem?
extern "C"
or C++ name mangling will break things. – Glassman--as-needed
thing that comes in the way... – Lota