包含gl.h时VC ++编译错误 [英] VC++ compile errors when including gl.h

查看:108
本文介绍了包含gl.h时VC ++编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual C ++编译使用OpenGL的文件时,当我尝试包含gl.h头文件时,出现约150个无用的编译错误:

Compiling a file that uses OpenGL with Visual C++, when I try to include the gl.h header file I get about 150 unhelpful compile errors:

错误C2144:语法错误:"void"之前应加上;"

error C2144: syntax error : 'void' should be preceded by ';'

错误C4430:缺少类型说明符-假定为int.注意:C ++不支持default-int

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

错误C2146:语法错误:缺少';'在标识符"glAccum"之前

error C2146: syntax error : missing ';' before identifier 'glAccum'

推荐答案

#include <windows.h><gl/gl.h><gl/glu.h>之前. 对于某些类型,例如WINGDIAPIAPIENTRY,它是必需的.

Just #include <windows.h> before <gl/gl.h> or <gl/glu.h>. It is needed for some types, such as WINGDIAPI and APIENTRY.

这篇关于包含gl.h时VC ++编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆