![](/img/trans.png)
[英]How to fix this Error: #include <gl/glut.h> “Cannot open source file gl/glut.h”
[英]# include <GL/glut.h> File Not Found in Xcode
我正在嘗試在Xcode中運行openGL程序,但是以下代碼的一行卻出現了錯誤:
#ifdef __MAC__
# include <GLUT/glut.h>
#else
# include <GL/glut.h> // in this line, I am getting the error that the file is not found
#endif
我添加了GLUT框架和openGL框架-不確定是否相關)。
如果出現錯誤,我會寫下面的波紋管。 這種方式僅適用於OSX。
#ifndef __MAC__
#define __MAC__ 1
#endif
#ifdef __MAC__
# include <GLUT/glut.h>
#else
# include <GL/glut.h> // in this line, I am getting the error that the file is not found
#endif
在所有平台上使用<GLUT/glut.h>
代替<GL/glut.h>
。
前者在最新更新中已過時,您可能會收到警告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.