2009-09-02 97 views
1

我有一个代码,可以在我的电脑上生成错误,但不会在其他PC上。我安装了Windows 7并且还安装了兼容的Windows 7.我还包括VC目录(来自工具 - > option-> vc Diretories),但代码仍然会生成follwing错误。在VC++中的一些错误

 
error C2059: syntax error : 'constant' 
error C2238: unexpected token(s) preceding ';' 
error C2589: '(' : illegal token on right side of '::' 
warning C4091: '' : ignored on left of 'const unsigned int' when no variable is declared 
error C2143: syntax error : missing ';' before '::' 
error C2059: syntax error : '::' 
error C2059: syntax error : 'constant' 
error C2238: unexpected token(s) preceding ';' 

语句生成错误表现如下

static const unsigned int MAPVK_VK_TO_CHAR; 
const unsigned int KeyLogger :: MAPVK_VK_TO_CHAR = 0x02; 
+0

我认为我们需要看到比这更多的代码。 我想你有一个宏定义的地方 – Mark 2009-09-02 15:28:21

+0

感谢您的宝贵意见! – 2009-09-03 12:17:11

回答

3

尝试选择MAPVK_VK_TO_CHAR并按F12查看该符号是否在别处声明。

+0

感谢您的宝贵建议! 我的问题通过尝试您的建议解决。 – 2009-09-03 12:19:06

+0

如果它解决了你的问题,那你为什么不接受答案? – sbi 2009-09-04 09:16:05

+0

抱歉,实际上我迟迟没有找到答案,并再次感谢您的帮助。 – 2009-10-07 15:22:47

1

什么MAPVK_VK_TO_CHAR?我问,因为错误可能表明这是一些宏观。

为什么你要一个普通的标识符(而不是宏)全部大写,无论如何?这只是乞求<windows.h>的数千个宏中的一个来践踏它。 (并不是说所有上限都可以防止这种情况,因为<windows.h>亵渎了许多混合大小写的宏...)

否则,您将不得不粘贴一些显示该问题的最小且可编译的示例。

+0

非常感谢您的评论 – 2009-10-07 15:23:35