Why can't C++ find GLM headers?

Barney Chambers picture Barney Chambers · Mar 11, 2015 · Viewed 29k times · Source

I do not have permissions to put GLM into usr/local/include or usr/include but I need to use GLM for openGL. The code (I am not able to change) looks for GLM like this:

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

the folder glm is in the same directory as my main.cpp where this code is from. I think it's not working because it's looking for glm in usr/include where in built headers are (im using redhat linux)

How can I stop this from happening, since I cannot run:

 g++ main.cpp -lGL -lglut -lGLEW

without these errors:

main.cpp:46:23: error: glm/glm.hpp: No such file or directory
main.cpp:47:40: error: glm/gtc/matrix_transform.hpp: No such file or directory
main.cpp:48:32: error: glm/gtc/type_ptr.hpp: No such file or directory
main.cpp:62: error: ‘glm’ has not been declared
main.cpp:62: error: expected constructor, destructor, or type conversion before ‘cameraMatrix’
main.cpp: In function ‘int setShaderData(const unsigned int&)’:
main.cpp:102: error: ‘glm’ has not been declared
main.cpp:102: error: expected ‘;’ before ‘projection’
main.cpp:105: error: ‘glm’ has not been declared
main.cpp:105: error: ‘projection’ was not declared in this scope
main.cpp:109: error: ‘glm’ has not been declared
main.cpp:109: error: expected ‘;’ before ‘modelview’
main.cpp: In function ‘void render()’:
main.cpp:187: error: ‘cameraMatrix’ was not declared in this scope
main.cpp:187: error: ‘glm’ has not been declared
main.cpp:200: error: ‘glm’ has not been declared

Answer

SerCe picture SerCe · Jan 17, 2016

My answer isn't really related to the author's question, but I'm just leaving it here for those, who come here from ubuntu with a missing package

sudo apt-get install libglm-dev