Visual Studio 不允许我使用某些变量名称
我正在使用 Visual Studio 2010 Express。当我使用某些变量名称(例如“near”、“far”、“IN”、“OUT”)时,我无法编译:在使用的变量名称后面出现语法错误。 示例:
z = 1.0/(far - near);
错误:
error C2059: syntax error : ')'
如何禁用此“功能”?
I'm using Visual Studio 2010 Express. When I use certain variable names, like "near, "far", "IN", "OUT", I can't compile: I get syntax errors located after the variable name used.
Example:
z = 1.0/(far - near);
Error:
error C2059: syntax error : ')'
How can I disable this "feature"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
far
和near
是 16 位时代的内置编译器关键字。它们不再存在,也不再具有任何意义,但出于向后兼容性的原因,它们仍然在 Windows 标头中定义为宏。如果您不需要它们,只需取消定义它们(或不包含 Windows 标头):
far
andnear
were built-in compiler keywords back in the 16-bit days. They no longer exist and they no longer have any meaning, but they're still defined as macros in the Windows headers for backwards compatibility reasons.If you don't want them, just undefine them (or don't include the Windows headers):