2010-09-23 55 views
1

在編寫錯誤C2065:DWORD_PTR「:未聲明的標識符

#include "windows.h" 
#include "stdafx.h" 
#include "resource.h" 
#include "ProgressDlg.h" 
    .... 
    ... 
rItem.lParam = (LPARAM)(DWORD_PTR) m_lsStatusMessages.back().c_str(); 

我收到錯誤C2065:DWORD_PTR」:未聲明的標識符

我錯過任何包含。

+0

http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/0300699f-4f0d-46dc-9c47-c4f5f0a2356b/ – DumbCoder 2010-09-23 12:05:10

回答

1

DWORD_PTRbasetsd.h定義,但你應該包括windows.h

+0

我不是答案。 http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/0300699f-4f0d-46dc-9c47-c4f5f0a2356b/ – DumbCoder 2010-09-23 12:04:31

+0

包括windows.h,編輯與更新的問題 – Simsons 2010-09-23 12:10:37

0

如果我沒記錯的話,你至少需要一個定義。該basetsd.h包含有類似

#if(_WIN32_WINNT >= 0x0400) 

#if(WINVER >= 0x0502) 

你可以給它一個鏡頭,並添加

#define _WIN32_WINNT 0x0501 
#define WINVER 0x0501 

您包括您windows.h適用於Windows XP要求設置之前。

預處理器定義和Windows頭文件的概述可以找到 here

+0

嘗試與它但Dint幫助,我使用VC++ 6.0,如果它有幫助 – Simsons 2010-09-23 12:34:05

+1

@Subhen:VC6早於引入DWORD_PTR。您將不得不手動更新平臺SDK才能獲取它。看到這裏:http://stackoverflow.com/questions/2723284/ – 2010-09-23 13:33:33

2
#include "windows.h" 
#include "stdafx.h" 

假設您實際使用MSVC中的預編譯頭支持,這是您的問題。您(嘗試)在stdafx.h之前包含windows.h。在#include "stdafx.h"之前的代碼的每一行都被忽略。 IIRC MSVC在某些版本中也給出了一些警告。

可以將#include "windows.h"置入stdafx.h或將其移至#include "stdafx.h"以下。

相關問題