Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 为什么可以';tc++;查找GLM标题?_C++_Opengl_Directory_Directory Structure_Glm Math - Fatal编程技术网

C++ 为什么可以';tc++;查找GLM标题?

C++ 为什么可以';tc++;查找GLM标题?,c++,opengl,directory,directory-structure,glm-math,C++,Opengl,Directory,Directory Structure,Glm Math,我没有将GLM放入usr/local/include或usr/include的权限,但我需要将GLM用于openGL。代码(我无法更改)的GLM如下所示: #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> 如果没有这些错误: main.cpp:46:23: error: glm/glm.hpp: No such file

我没有将GLM放入usr/local/include或usr/include的权限,但我需要将GLM用于openGL。代码(我无法更改)的GLM如下所示:

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
如果没有这些错误:

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

虽然如果你用软件包管理器安装它,它很可能会出现在你的系统包含路径中。

我的答案与作者的问题并不相关,但我只是把它留给那些从ubuntu带着丢失的软件包来到这里的人

sudo apt-get install libglm-dev

谢谢你的帮助,我读到了,因为它只是头文件,没有什么可安装的,这是真的吗?另外,我已经下载了它,它和我的main.cpp在同一个文件夹中。我的-I论点应该怎么说?@BarneyChambers尝试
-I.
-I./headers
谢谢你,Amadeus,这很有效。我的openGL仍然有一个错误,但这是一个很大的帮助你是我们的英雄:哈哈:
sudo apt-get install libglm-dev