I just want to start in openGL programming, so I installed freeglut3 from the repositories of ubuntu and I have all mesa packages installed, as well as build-essentials.
Later, I copied one simple example of openGL wiki
In first, I tried to compile it with: gcc triangle.c -o triangle.o
;
but, later, I read here: Linker error : undefined reference to symbol 'glOrtho' that i have to linked the libraries with -l.
So, I tried with gcc triangle.c -lglut -lGL -Wall -o triangle.o
Both return the same error:
/tmp/ccKLT4ac.o: In function `main':
triangle.c:(.text+0x2b): undefined reference to `glutInit'
triangle.c:(.text+0x37): undefined reference to `glutInitDisplayMode'
triangle.c:(.text+0x4b): undefined reference to `glutInitWindowSize'
triangle.c:(.text+0x57): undefined reference to `glutCreateWindow'
triangle.c:(.text+0x5c): undefined reference to `glewInit'
triangle.c:(.text+0x73): undefined reference to `glewGetErrorString'
triangle.c:(.text+0xaa): undefined reference to `glutDisplayFunc'
triangle.c:(.text+0xaf): undefined reference to `glutMainLoop'
collect2: error: ld returned 1 exit status
I've tried to include gl.h & glu.h libraries, try with a lot of different example programs in cpp,... and a lot of combinations. All return similar errors.
ah, in /usr/include I have all the libraries:
akronix@ASJ-Netbook:~$ ls /usr/include/GL
freeglut_ext.h glext.h glu_mangle.h glx.h glxproto.h
freeglut.h gl.h glut.h glxint.h glxtokens.h
freeglut_std.h gl_mangle.h glxew.h glx_mangle.h internal
glew.h glu.h glxext.h glxmd.h wglew.h