2022年5月20日

[Windows] GLEW Troubleshooting

問題描述與解決方法

 

  1. 問題:'glewInit': identifier not found


解法:

  • 檢查是否有添加 #include <GL/glew.h>
  • 檢查 glew.h 是否放置到正確的 include 路徑下。

 

  1. 問題:unresolved external symbol __imp_glewInit


解法:

  • 在程式碼上方添加 #pragma comment( lib, "glew32.lib" ),告知 linker 鏈接 glew32.lib 文件,

此為 GLEW 預設採用的動態鏈接。

  • 也可以在程式碼第一行添加 #define GLEW_STATIC,採用靜態鏈接,並將上面敘述改為

#pragma comment( lib, "glew32s.lib" )。

 

  1. 問題:gl.h included before glew.h


解法:

  • 引用 glew.h 前,不允許 gl.h 已經被引用。因此,若引用了 glut.h,則 glew.h 要放在 glut.h 上面。
  • 將 #include <GL/glew.h> 敘述移到上面。

 

 

參考資料

 

  • 关于glew库的使用问题(unresolved external symbol __imp__glewInit@0)

https://www.cxyzjd.com/article/swazer_z/17526033

 

 

沒有留言:

發佈留言

和我聯絡

姓名

電子郵件 *

訊息 *