簡體   English   中英

如果沒有“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 ,沒有兩個標頭將在Graphics.cpp上打印錯誤, 'gluErrorString' was not declared in this scope
  2. 使用<GLFW/glfw3.h>和 '' 編譯Graphics.cpp ,沒有<windows.h>將在glu.h上打印錯誤, c:\\mingw\\include\\gl\\glu.h|225|error: 'WINGDIAPI' does not name a type 我發現的一些解決方法是在Graphics.cpp也包含<windows.h>
  3. 使用<GLFW/glfw3.h> AND '' AND <windows.h>編譯Graphics.cpp不會返回錯誤。 問題是這個程序不是跨平台的不是嗎?

Including the GLFW header file部分中的GLFW 構建指南所述; 不需要包含windows.h和 OpenGL 頭文件,因為 GLFW 頭文件已經包含了這些。 所以我正在嘗試遵循指南或最佳實踐,並嘗試使我的游戲引擎跨平台。

以下是我在 CodeBlock 中的鏈接器選項,

-lglfw3
-lOpenGL32
-lglu32
-lgdi32

原來我只需要在#defines部分的 CodeBlock 編譯器設置中編寫GLFW_INCLUDE_GLU

資料來源: 構建 GLFW 程序,作者:Sugih Jamin

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM