由于“不允许类型名称"而使代码在 MSVC++ 2010 中工作的解决方法 [英] Workaround to get codes to work in MSVC++ 2010 due to "Type name is not allowed"

查看:35
本文介绍了由于“不允许类型名称"而使代码在 MSVC++ 2010 中工作的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现手指检测,该链接在here.我是否正在查看 MSVC2010 中的代码,它给了我如下图所示的错误.有人能告诉我为什么下面的代码给我错误吗?这与以下这些问题有关吗?123?有可能的解决方法吗?我已经包括:

I am trying to implement a finger detection, which link is given here. Am I am going through the code in MSVC2010, it gives me error as shown in Figure as shown below. Could someone tell me why the following codes gives me error? Is this related to these following questions; 1, 2, 3? Is there a possible workaround? I already included:

#include <cstdint> 
#include <stdint.h>

我也试过:

unsigned short depth = (unsigned short) (v[2] * 1000.0f); // hand depth
unsigned short near = (unsigned short) (depth - 100); // near clipping plane
unsigned short far = (unsigned short) (depth + 100); // far clipping plane

但是没有用.

谢谢,

爱可

推荐答案

原因是 nearfar 已经是 #defined在别处作为别的东西.如果您已经包含 windows.h,这很典型,其中包含 windef.h 和以下宏:

The reason is that near and far are already #defined elsewhere as something else. This is typical if you have already included windows.h, which includes windef.h with following macros:

#define far
#define near
#if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
#define pascal __stdcall
#else
#define pascal
#endif

尝试将名称更改为 plane_nearplane_far 之类的名称,它会起作用.

Try changing names into something like plane_near and plane_far and it will work.

这篇关于由于“不允许类型名称"而使代码在 MSVC++ 2010 中工作的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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