Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/144.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

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++ OpenGL的新功能-如何编译?_C++_Opengl_Graphics_Import_G++ - Fatal编程技术网

C++ OpenGL的新功能-如何编译?

C++ OpenGL的新功能-如何编译?,c++,opengl,graphics,import,g++,C++,Opengl,Graphics,Import,G++,我有一个包含以下导入的文件: // Include standard headers #include <stdio.h> #include <stdlib.h> #include <vector> // Include GLEW #include <GL/glew.h> // Include GLFW #include <glfw3.h> GLFWwindow* window; // Include GLM #include &

我有一个包含以下导入的文件:

// Include standard headers
#include <stdio.h>
#include <stdlib.h>
#include <vector>

// Include GLEW
#include <GL/glew.h>

// Include GLFW
#include <glfw3.h>
GLFWwindow* window;

// Include GLM
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtx/norm.hpp>
using namespace glm;

// Include AntTweakBar
#include <AntTweakBar.h>


#include <common/shader.hpp>
#include <common/texture.hpp>
#include <common/controls.hpp>
#include <common/objloader.hpp>
#include <common/vboindexer.hpp>
#include <common/quaternion_utils.hpp> // See quaternion_utils.cpp for RotationBetweenVectors, LookAt and RotateTowards
我得到以下错误:

rotatetest.cpp:7:23: error: GLUT/glew.h: No such file or directory
rotatetest.cpp:10:19: error: glfw3.h: No such file or directory
rotatetest.cpp:14:23: error: glm/glm.hpp: No such file or directory
rotatetest.cpp:15:40: error: glm/gtc/matrix_transform.hpp: No such file or directory
rotatetest.cpp:16:34: error: glm/gtc/quaternion.hpp: No such file or directory
rotatetest.cpp:17:34: error: glm/gtx/quaternion.hpp: No such file or directory
rotatetest.cpp:18:36: error: glm/gtx/euler_angles.hpp: No such file or directory
rotatetest.cpp:19:28: error: glm/gtx/norm.hpp: No such file or directory
rotatetest.cpp:23:25: error: AntTweakBar.h: No such file or directory
我知道这段代码是有效的,因为a)它来自教程,b)当它是XCode项目的一部分时,我可以成功地运行它,而不是作为一个独立的文件

我使用的是Mac OS X 10.8.5。有人能告诉我如何编译这个吗?

文件中的include指令要求在系统include目录中提供与OpenGL相关的标题。命令行上的g++可能使用与XCode不同的系统包含目录。 确保额外的OpenGL头(GLFW、GLM、GLUT)也放置在您的g++安装中


您可能还必须为静态库执行此操作。

对,但我具体如何执行此操作?我相信在OSx中,g++的默认系统include目录是/usr/include/。如果尚未下载库(GLUT、GLFW、GLM),请下载它们,并将其包含文件夹的内容复制到/usr/include/。您还应该将这些软件包附带的lib文件夹的内容复制到/usr/lib/。如何找到这些库的位置?我认为它们必须下载,因为当我通过教程让Xcode为我做所有事情时,所有的代码都能完美地工作。但是我不确定它们在哪里,因为我想它们已经安装好了。您可以使用命令行上的
-I
选项指定其他包含目录。您可能还必须为Xcode设置include目录。否则,请使用Spotlight或
find
命令查找标题。这些不是标准头,所以您安装了它们。解决该问题后,还必须将库的
-l
选项移到命令行的末尾。
rotatetest.cpp:7:23: error: GLUT/glew.h: No such file or directory
rotatetest.cpp:10:19: error: glfw3.h: No such file or directory
rotatetest.cpp:14:23: error: glm/glm.hpp: No such file or directory
rotatetest.cpp:15:40: error: glm/gtc/matrix_transform.hpp: No such file or directory
rotatetest.cpp:16:34: error: glm/gtc/quaternion.hpp: No such file or directory
rotatetest.cpp:17:34: error: glm/gtx/quaternion.hpp: No such file or directory
rotatetest.cpp:18:36: error: glm/gtx/euler_angles.hpp: No such file or directory
rotatetest.cpp:19:28: error: glm/gtx/norm.hpp: No such file or directory
rotatetest.cpp:23:25: error: AntTweakBar.h: No such file or directory