[英]GLFW cannot compile without "glu.h" and "windows.h"
I want to create a game engine, but my graphics subsystem will not compile without <GL/glu.h>
and <windows.h>
.我想创建一个游戏引擎,但如果没有
<GL/glu.h>
和<windows.h>
,我的图形子系统将无法编译。
Graphics.cpp
with only <GLFW/glfw3.h>
, without both headers will print the error on Graphics.cpp
, 'gluErrorString' was not declared in this scope
.<GLFW/glfw3.h>
编译Graphics.cpp
,没有两个标头将在Graphics.cpp
上打印错误, 'gluErrorString' was not declared in this scope
。Graphics.cpp
with <GLFW/glfw3.h>
AND '', without <windows.h>
will print the error on glu.h
, c:\\mingw\\include\\gl\\glu.h|225|error: 'WINGDIAPI' does not name a type
.<GLFW/glfw3.h>
和 '' 编译Graphics.cpp
,没有<windows.h>
将在glu.h
上打印错误, c:\\mingw\\include\\gl\\glu.h|225|error: 'WINGDIAPI' does not name a type
。 Some workaround I found is to include also the <windows.h>
in Graphics.cpp
.Graphics.cpp
也包含<windows.h>
。Graphics.cpp
with <GLFW/glfw3.h>
AND '' AND <windows.h>
returns no error.<GLFW/glfw3.h>
AND '' AND <windows.h>
编译Graphics.cpp
不会返回错误。 The problem is that this program is not cross-platform isn't it? As stated in GLFW build guide in the Including the GLFW header file
section;如
Including the GLFW header file
部分中的GLFW 构建指南所述; One does not need to include windows.h
and OpenGL header files, since GLFW header already included these.不需要包含
windows.h
和 OpenGL 头文件,因为 GLFW 头文件已经包含了这些。 So I am trying to follow the guide or best practice, and trying to make my game engine cross-platform.所以我正在尝试遵循指南或最佳实践,并尝试使我的游戏引擎跨平台。
Followings are my linker options in CodeBlock,以下是我在 CodeBlock 中的链接器选项,
-lglfw3
-lOpenGL32
-lglu32
-lgdi32
Turns out I only have to write GLFW_INCLUDE_GLU
in CodeBlock's compiler settings in the #defines
section.原来我只需要在
#defines
部分的 CodeBlock 编译器设置中编写GLFW_INCLUDE_GLU
。
Source: Building GLFW program, by Sugih Jamin资料来源: 构建 GLFW 程序,作者:Sugih Jamin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.