2011-12-22 198 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中时,我遇到了同样的问题。