本文介绍了不能将变量命名为“远”和“接近”当使用GLAD时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用生成了一个加载器




  • 语言:C / C ++

  • GL:4.5版




当在任何文件中包含 glad.h code> near 和 far 不能使用。它导致一个预期的标识符错误C2513没有变量声明之前的'='在Visual Studio 2015在Windows 10。

  #include< glad\glad.h> 

int main()
{
float near = 1.0f;
char far = 2.0f;

return 0;
}

code>



pre> typedef void(APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near,GLdouble far);
GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange;


解决方案

看起来这些名称被定义为



通常这些名称用于定义所谓的near和far地址。


I generated a loader with http://glad.dav1d.de/

  • Language: C/C++
  • GL: Version 4.5
  • Profile: Core

When I include glad.h in any file, variable names of near and far can't be used. It results in an expected an identifier, and Error C2513 no variable declared before '=' on Visual Studio 2015 on Windows 10.

#include <glad\glad.h>

int main()
{
    float near = 1.0f;
    char far = 2.0f;

    return 0;
}

The only place where I could find near and far in glad.h

typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far);
GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange;
解决方案

It seems that these names are defined as macros in the header or in a header that is included by this header

Usually these names are used for defining so-called near and far addresses.

这篇关于不能将变量命名为“远”和“接近”当使用GLAD时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 20:47