OpenGL compile error

Hello All.

I am having a compile error with openGL. I have not been able to figure it out for a few days now. I'm compiling through terminal commands.

g++ tutorial02.cpp -lGL -lGLEW -L /usr/local/lib/ -lglfw

1
2
3
4
/tmp/ccCWB3eN.o: In function `main':
tutorial02.cpp:(.text+0x149): undefined reference to `LoadShaders(char const*, char const*)'
collect2: error: ld returned 1 exit status
willie@Toede:~/Downloads/OpenGL-tutorial_v0014_21/tutorial02_red_triangle$ 


The only line of code that uses the LoadShaders function is this one at line 57
1
2
// Create and compile our GLSL program from the shaders
GLuint programID = LoadShaders( "SimpleVertexShader.vertexshader", "SimpleFragmentShader.fragmentshader" );


The tutorial2.cpp is downloaded right from the opengltutorial.org. So one wouldn't think that the function was called wrong or the code has a typo somewhere.

I think it has something to do with the "SimpleVertexShader.vertexshader",
"SimpleFragmentShader.fragmentshader" files. Are they supposed to be called out in a header to be called out in line 57 or maybe I am just missing a linker?
I did read the tutorial, I'm not sure if cmake installed anything correctly because none of the test executes work correctly.

I have the shader.cpp and shader.hpp both in a directory called common.

The error in my OP resulted when the I had the #include "common/shader.hpp" I forgot I changed it because I don't know what I'm doing.

#include <common/shader> gave this error
1
2
3
tutorial02.cpp:19:29: fatal error: common/shader.hpp: No such file or directory
 #include <common/shader.hpp>                             
compilation terminated.


That error seems like less of a problem, does this mean the compiler isn't searching in the right place?
Try changing it to #include "common/shader.hpp" .
given that those are not your files you could use the -isystem flag
or
# make install

You can use Qt. This is my example how to move square with texture: https://github.com/8Observer8/Lesson008_TexturedSquare

This is my first steps for Tank Game: https://yadi.sk/d/KYHagmMJdzuns
Qt will not help the situation (and it probably was already solved).
Topic archived. No new replies allowed.