Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't C++ find GLM headers?

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
like image 919
Barney Chambers Avatar asked Mar 11 '15 02:03

Barney Chambers


People also ask

Is GLM part of OpenGL?

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 Voting is disabled while the site is in read-only mode. Voting is disabled while the site is in read-only mode. Show activity on this post. GLM is not part of OpenGL.

What version of OpenGL do the header files come with?

If you're on Windows, they are installed with the platform SDK (or Visual Studio). However the header files are only compatible with OpenGL 1.1. You need to create function pointers for new functionality it later versions. Can you please clarify what version of OpenGL you're trying to use.

How to use OpenGL without GL_ARB_compatibility extension?

If you want to use OpenGL 3.x or OpenGL 4.x functionality without the functionality which were moved into the GL_ARB_compatibility extension, use the new gl3.h header from the registry webpage. It replaces gl.h and also glext.h (as long as you only need core functionality). Last but not the least, glaux.h is not a header associated with OpenGL.

Where do I install the headers?

Headers are in the SDK : C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl What operating system? but not the difference in a) capitalization and b) forward/backward slashes. Your example is likely to be wrong in its use of backslashes. If you're on Windows, they are installed with the platform SDK (or Visual Studio).


1 Answers

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
like image 94
SerCe Avatar answered Oct 06 '22 22:10

SerCe