我没有权限将GLM放入usr / local / include或usr / include,但是我需要对OpenGL使用GLM。代码(我无法更改)看起来像这样的GLM:
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
该文件夹glm与我的main.cpp位于同一目录中,此代码来自该目录。我认为这是行不通的,因为它正在usr / include中查找glm,其中内置标头位于其中(即使用redhat linux)
由于无法运行,我该如何阻止这种情况发生:
g++ main.cpp -lGL -lglut -lGLEW
没有这些错误:
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
GLM不属于OpenGL。这是一个C ++数学库,语法与GLSL相同。为了使用它,您需要从这里下载它或使用程序包管理器安装它(尽管如果您对此计算机没有管理权限,那么您将无法执行此操作)。
拥有它后,需要将其添加到您的包含路径中:
g++ main.cpp -lGL -lglut -lGLEW -I/path/to/glm/headers
尽管如果使用软件包管理器安装它,则它可能最终会出现在您的系统包含路径中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句