没有 "glu.h" 和 "windows.h" GLFW 无法编译

GLFW cannot compile without "glu.h" and "windows.h"

我想创建一个游戏引擎,但如果没有 <GL/glu.h><windows.h>,我的图形子系统将无法编译。

  1. 仅使用 <GLFW/glfw3.h> 编译 Graphics.cpp,而不使用两个 header 将在 Graphics.cpp'gluErrorString' was not declared in this scope.
  2. 上打印错误
  3. 使用 <GLFW/glfw3.h> AND '' 编译 Graphics.cpp,不使用 <windows.h> 将在 glu.hc:\mingw\include\gl\glu.h|225|error: 'WINGDIAPI' does not name a type 上打印错误。我发现的一些解决方法是在 Graphics.cpp.
  4. 中也包含 <windows.h>
  5. 使用 <GLFW/glfw3.h> AND '' AND <windows.h> returns 编译 Graphics.cpp 没有错误。问题是这个程序不是cross-platform不是吗?

Including the GLFW header file 部分中的 GLFW build guide 所述;不需要包含 windows.h 和 OpenGL header 文件,因为 GLFW header 已经包含了这些文件。所以我正在尝试遵循指南或最佳实践,并尝试制作我的游戏引擎 cross-platform.

以下是我在 CodeBlock 中的链接器选项,

-lglfw3
-lOpenGL32
-lglu32
-lgdi32

结果我只需要在#defines部分的CodeBlock编译器设置中写GLFW_INCLUDE_GLU

来源:Building GLFW program, by Sugih Jamin