Can't name variables “far” and “near” when usi

2019-08-12 03:29发布

This question already has an answer here:

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;

1条回答
劳资没心,怎么记你
2楼-- · 2019-08-12 03:55

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.

查看更多
登录 后发表回答