I am running Linux Mint 14.1 64-bit
I installed the following libraries:
Mesa common-mode DEV, freeglut3-DEV, libglew-DEV
using the apt-get tool.
Here are my Main.h included in my file:
#include <cmath> #include <cstdlib> #include <iostream> #include <stdio.h> #include <GL/glew.h> #include <GL/glut.h> #include <time.h>
I checked that the libraries are 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 -switch-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 problems, then I try to create a binary file:
g++ -I/usr/include -L/usr/lib/x86_64-linux-gnu -lGL -lglut -lGLU -lGLEW -lX11 -lm -lrt -lpng Main.o -o main
And get the following errors:
Main.o: In function `init()': /path/to/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'
Compilation of the program and links to another Linux system. what can i lose?
c ++ linux linker freeglut mint
Finalfortune
source share