2011-12-22 199 views
2

我有一個項目,我首先用gcc生成gl3w.c,然後用g ++編譯我自己的OGLGraphics.cpp文件。 GCC編譯成功gl3w.c但是當G ++試圖編譯包括gl3w.h文件我得到這些錯誤:從C++文件gl3w錯誤

In file included from /mnt/hgfs/grace/src/grace-output/graphics/OGLGraphics.cpp:22:0: 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:69:8: error: ‘PFNGLDRAWARRAYSPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:70:8: error: ‘PFNGLDRAWELEMENTSPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:71:8: error: ‘PFNGLGETPOINTERVPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:72:8: error: ‘PFNGLPOLYGONOFFSETPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:73:8: error: ‘PFNGLCOPYTEXIMAGE1DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:74:8: error: ‘PFNGLCOPYTEXIMAGE2DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:75:8: error: ‘PFNGLCOPYTEXSUBIMAGE1DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:76:8: error: ‘PFNGLCOPYTEXSUBIMAGE2DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:77:8: error: ‘PFNGLTEXSUBIMAGE1DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:78:8: error: ‘PFNGLTEXSUBIMAGE2DPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:79:8: error: ‘PFNGLBINDTEXTUREPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:80:8: error: ‘PFNGLDELETETEXTURESPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:81:8: error: ‘PFNGLGENTEXTURESPROC’ does not name a type 
/mnt/hgfs/grace/src/grace-output/include/GL3/gl3w.h:82:8: error: ‘PFNGLISTEXTUREPROC’ does not name a type 

我不知道爲什麼它的工作原理與C文件而不是從C++?

回答

6

您是否按照GL3W自述文件中概述的步驟操作?具體來說,關於包含gl3w.h的部分首先是,之前的任何OpenGL文件。

哦,之前window.h,其中可以包括gl.h

+0

是的,我在gl3w之前包含了glfw,謝謝! – grivescorbett 2011-12-22 13:38:21

0
extern PFNGLDRAWARRAYSPROC gl3wDrawArrays; <—— unknown type name PFNGLDRAWARRAYSPROC 

此錯誤是由在代碼中包含的#include <OpenGL/gl.h>如GLTriangleBatch.h引起的。如果你用#include「GL/gl3w.h」代替OpenGL 3/4調用,那麼這將消除錯誤。我認爲在不同版本的OpenGL調用之間存在衝突,並導致未知的類型錯誤當我試圖將SuperBible 5代碼移植到SB6中時,我遇到了同樣的問題。