Hi:
I've some experience programming on high-level (C#, java) and I thought it was time to learn some low-level stuff. I'm trying to make a test program using c++, opengl and make.
My .cpp is very simple:
Code:
#include <iostream>
#include <GL/glew.h>
#include <GL/glut.h>
void render();
int main(int argc, char** args){
int exitCode = 0;
glutInit(&argc, args);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(640,480);
glutCreateWindow("Hi again");
glutDisplayFunc(render);
glutMainLoop();
return exitCode;
}
void render (void){
}
And also I have coded a simple make file:
Code:
testings: testings.o
g++ testings.o -o testings -lglut
testings.o: testings.cpp
g++ -c -Wall testings.cpp
I can compile my program from terminal running:
Code:
g++ -c -Wall testings.cpp
g++ testings.o -o testings -lglut
An it runs at expected (creates a window, and doesn't refresh the contents of it). But if when I use:
I get:
Code:
g++ testings.cpp -o testings
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutInit'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutInitDisplayMode'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutInitWindowPosition'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutInitWindowSize'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutCreateWindow'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutDisplayFunc'
/tmp/ccAjW2UV.o:testings.cpp:function main: error: undefined reference to 'glutMainLoop'
collect2: error: ld returned 1 exit status
make: *** [testings] Error 1
From the little I know, this means the compiler is missing some links, but the link I've provided are the same for the terminal and the makefile (-lglut). I don't believe it's because it's missing a library, because I've installed:
libglew1.8
glew-utils
libglew-dev
freeglut3
freeglut3-dev.
I've have the feeling that it's probably my mistake in some subtlety the makefile, but hours have passed and I can't find the error (I'ts almost 4 am here).
That's it, thank you for reading this far an let's hope it's just a little thingy
Bookmarks