Search code examples
c++visual-studioincludeglm-math

visual studio error: glm can't open glm\detail\glm.cpp


I learn opengl and follow the code in https://github.com/JoeyDeVries/LearnOpenGL

First chapter can run, but after introduce glm, I found an error: can' t open source code: "glm\detail\glm.cpp": No such file or directory.

My code is:

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>

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

#include <shader.h>

#include <iostream>

I have included my "include" folder in solution resource manager, and I also entered my include directory path into properity - additional include directory.

solution resource manager

additional include directory

When I hold "Ctrl" key and hover my mouse on "#include <glm/glm.hpp>", it turns blue and clicking can result in jumping into glm code. So it may shows that I have include glm successfully but somewhere wrong?


Solution

  • I may be make a mistake in Visual Studio, I found two glm.cpp are included in solution resource manager, only when I switch to Solution view and drag the windows handle to see the situation of glm.cpp, then I found this mistake. The two glm.cpp have different relative path, looks weird. One of these two glm.cpp is double clicked and then give error, so I exclude it from solution, then no error. All in all, it is a trival mistake about Visual Studio Solution management but no opengl.