2009-09-02 96 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