gpt4 book ai didi

opengl - <高兴/高兴.h> : No such file or directory

转载 作者:行者123 更新时间:2023-12-04 04:33:21 26 4
gpt4 key购买 nike

我正在关注 this tutorial学习 OpenGL,但我在编译时遇到问题,因为编译器找不到头文件之一。

这是我试图编译的文件:

#include <glad/glad.h>
#include <GLFW/glfw3.h>

int main() {
return 0;
}

要编译,我正在使用
$ gcc -o sandbox sandbox.cpp -lGL -lGLU -lglut

我收到以下错误:
sandbox.cpp:1:23: fatal error: glad/glad.h: No such file or directory
#include <glad/glad.h>
^
compilation terminated.

我关注了 this wiki的前两节安装 OpenGL 和库。

我认为问题是错误的编译命令或我的 OpenGL 安装中的缺陷。

最佳答案

GLAD 是 OpenGL 的函数加载器。此 tutorial说明如何设置。

本教程解释了 GLAD 的用途:

Since there are many different versions of OpenGL drivers, the location of most of its functions is not known at compile-time and needs to be queried at run-time.



GLAD 的设置涉及使用 Web 服务器生成特定于您的 GL 版本、扩展和语言的源文件和头文件。然后将源文件和头文件放在项目的 src 和包含目录中。

关于opengl - <高兴/高兴.h> : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45492937/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com