Reputation: 834
how do i setup the GLM Library in visual studio 2012?
first i tried extract the glm librar directory to my VS 2012 project directory (the directory containing the glm library is named glm-0.9.4.4). then i tried to add glm-0.9.4.4 to
PROJECT -> properties -> VC++ directories -> Include Directories
and then when i tried to use the include #include <glm/glm.hpp>
in my code i got the following error:
fatal error C1083: Cannot open include file: 'glm/glm.hpp': No such file or directory
how do i set up the GLM library correctly to work in my code?
Upvotes: 10
Views: 44077
Reputation: 834
I succeeded in solving the problem. to add the GLM library to the include path, I did the following steps:
C:\projects\myProject
then extracted the glm code to this path (C:\projects\myProject
).C:\projects\myProject\glm-0.9.4.4
of the glm directory to:
=> right click on project in the solution viewer => from the drop down menu choose properties => C\C++ => General => Additional Include Directories.
C:\projects\myProject\glm-0.9.4.4
in the edit box of Additional Include Directories.Another option if you don't want to use full path for the glm library (or any other library you want to include in you project in general), is to use the path .\glm-0.9.4.4
instead of the full path (this will work only if you extracted the glm library to the project directory!)
Upvotes: 9
Reputation: 4641
GLM is a header-only library, so it's just a matter of getting it to include into your project nicely.
Did you actually put the GLM folder in your include path? The folder "glm-0.9.4.4" is not the same as "glm". Basically make sure the path you're trying to include actually lines up.
If you're including something in a local (project) directory, use quotes instead of angle brackets to include something. #include "glm/glm.hpp"
. However if you've told VC to look in the directory where you put GLM, brackets should work. Generally, brackets look in your include path and quotes look in your local path. See this question for a better explanation.
Your default include path should look something like C:/.../Microsoft Visual Studio 12/VC/include
. You can dump it there so it can be accessible to all of your projects if you don't feel like re-copying it to each new project you make. If you don't want to do that, find your project directory and place the "glm" folder where all of your other header files are and #include
it with quotes instead of brackets.
Have you tried snooping around for this on your own? Search for where stdio.h lives or where a folder called "include" is.
Upvotes: 3
Reputation: 576
You could also just import the whole glm folder into your project and then use quotation to include the glm.hpp file. It's worked with me in the past without worrying much about the header include directories etc.
Upvotes: 1