Undefined Reference when I include GL\glut.h
May 21, 2013 at 2:31am UTC
I have a h file with the following in it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H
#include "TextureMap.h"
//#include <GL\glut.h>
#include <vector>
using namespace std;
class ResourceManager
{
public : ResourceManager();
public : unsigned char ***getTextureMap(int index);
private : vector<TextureMap*> _textureMaps;
};
#endif
and it compiles fine, but as soon as I uncomment that
//#include <GL\glut.h>
line, I get
undefined reference to `glutMainLoop'
I call glutMainLoop it it like so in ChubbyEngine.cpp:
1 2 3 4 5 6
void ChubbyEngine::start(Window &window)
{
_pWindow = &window;
glutMainLoop(); // execute until killed
}
which is called from main which looks like so:
1 2 3 4 5 6 7 8 9
int main(int argc, char ** argv)
{
ChubbyEngine chubbyEngine (argc, argv);
Window window (chubbyEngine, 25, 25, 800, 600, "3D ASCII MODELER" );
chubbyEngine.start(window);
return 0;
}
I am compiling with the following command
g++ -o Modeler -Wall *.cpp glut32.lib -lopengl32 -lglu32 -static
I am using glut and open gl in other portions of my project. Does anyone have any insight at all as to what may be causing this? I have a hard time understanding why simply including that file there would break my project, but I am more of a Java guy by trade :)
Thank you for your time,
Brandon
Last edited on May 21, 2013 at 2:54am UTC
May 21, 2013 at 3:10am UTC
So, I found out if I include both windows.h AND glut.h, it compiles fine.
Topic archived. No new replies allowed.