Freeglut in Linux Linking Issues

I am running Linux Mint 14.1 64-bit

I have installed the libs:

mesa-common-dev
freeglut3-dev
libglew-dev


through the aptitude package manager.

Here are my includes, located in my Main.h file

1
2
3
4
5
6
7
8
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <stdio.h>

#include <GL/glew.h>
#include <GL/glut.h>
#include <time.h> 


I checked that the libs installed correctly, they seem to be located in /usr/lib/x86_64-linux-gnu
and the headers in /usr/include/GL

I proceed to compile my Main.C file with the following flags:

g++ -Wall -Wextra -Weffc++ -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-parameter -Wstrict-overflow=5 -Wfloat-equal -Wshadow -Wc++0x-compat -Wconversion -Wsign-conversion -Wmissing-declarations -Wstrict-null-sentinel -Woverloaded-virtual -Wsign-promo -Werror -pedantic -Wcast-qual -fno-pretty-templates -fmessage-length=80 -fdiagnostics-show-option -g -std=c++0x -pipe -frepo -c  Main.C -o Main.o


Main.o is generated without any issues, then I try to create the binary:

g++  -I/usr/include -L/usr/lib/x86_64-linux-gnu -lGL -lglut -lGLU -lGLEW -lX11 -lm -lrt -lpng Main.o -o main


And receive the following errors:

Main.o: In function `init()':
/tmp/prac3/Main.C:12: undefined reference to `glClearColor'
Main.o: In function `initGLUT(int, char**)':
/path/to/Main.C: undefined reference to `glutInit'
/path/to/Main.C:21: undefined reference to `glutInitDisplayMode'
/path/to/Main.C:24: undefined reference to `glutInitWindowSize'
/path/to/Main.C:25: undefined reference to `glutCreateWindow'
/path/to/Main.C:28: undefined reference to `glutDisplayFunc'
/path/to/Main.C:31: undefined reference to `glutKeyboardFunc'
/path/to/Main.C:34: undefined reference to `glutMouseFunc'
/path/to/Main.C:37: undefined reference to `glutReshapeFunc'
/path/to/Main.C:40: undefined reference to `glutIdleFunc'
Main.o: In function `printFPS()':
/path/to/Main.C:96: undefined reference to `glutGet'
Main.o: In function `reshape(int, int)':
/path/to/Main.C:123: undefined reference to `glutPostRedisplay'
Main.o: In function `getTime()':
/path/to/Main.C:129: undefined reference to `glutGet'
Main.o: In function `idle()':
/path/to/Main.C:141: undefined reference to `glutPostRedisplay'
Main.o: In function `display()':
/path/to/Main.C:148: undefined reference to `glClearColor'
/path/to/Main.C:149: undefined reference to `glClear'
/path/to/Main.C:150: undefined reference to `glFlush'
/path/to/Main.C:151: undefined reference to `glutSwapBuffers'
Main.o: In function `main':
/path/to/Main.C:164: undefined reference to `glutMainLoop'


The program compiles on another Linux system though.
what could I be missing?

Last edited on
Topic archived. No new replies allowed.