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>
I also tried:
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
but did not work.
Thanks,
ikel
The reason is that near
and far
are already #define
d 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
Try changing names into something like plane_near
and plane_far
and it will work.
来源:https://stackoverflow.com/questions/12454961/workaround-to-get-codes-to-work-in-msvc-2010-due-to-type-name-is-not-allowed