我正在尝试将 ah 文件包含到我的项目中,但我发现了一些错误。该程序运行正常。我真的需要我包含的 H 文件,我什至尝试更改一些东西,但我的项目中仍然存在同样的问题。
问题的根源以粗体字列出。
代码在上面。
class AFX_MODULE_THREAD_STATE : public CNoTrackObject { public:
AFX_MODULE_THREAD_STATE();
virtual ~AFX_MODULE_THREAD_STATE();
// current CWinThread pointer
CWinThread* m_pCurrentWinThread;
// list of CFrameWnd objects for thread
CTypedSimpleList<CFrameWnd*> m_frameList;
// temporary/permanent map state
DWORD m_nTempMapLock; // if not 0, temp maps locked
CHandleMap* m_pmapHWND;
CHandleMap* m_pmapHMENU;
CHandleMap* m_pmapHDC;
CHandleMap* m_pmapHGDIOBJ;
CHandleMap* m_pmapHIMAGELIST;
// thread-local MFC new handler (separate from C-runtime)
_PNH m_pfnNewHandler;
#ifndef _AFX_NO_SOCKET_SUPPORT
// WinSock specific thread state
HWND m_hSocketWindow;
#ifdef _AFXDLL
CEmbeddedButActsLikePtr<CMapPtrToPtr> m_pmapSocketHandle;
CEmbeddedButActsLikePtr<CMapPtrToPtr> m_pmapDeadSockets;
CEmbeddedButActsLikePtr<CPtrList> m_plistSocketNotifications;
#else
CMapPtrToPtr* m_pmapSocketHandle;
CMapPtrToPtr* m_pmapDeadSockets;
CPtrList* m_plistSocketNotifications;
#endif
#endif
// common controls thread state
CToolTipCtrl* m_pToolTip;
CWnd* m_pLastHit; // last window to own tooltip
INT_PTR m_nLastHit; // last hittest code
TOOLINFO* m_pLastInfo; // 最后一个 TOOLINFO 结构
INT_PTR m_nLastStatus; // last flyby status message
CControlBar* m_pLastStatus; // last flyby status control bar
};
#if (_WIN32_WINNT >= 0x600)
#ifndef _WINSOCK2API_
#ifdef _WINSOCKAPI_
#error MFC 需要使用 Winsock2.h
#endif
#include <winsock2.h>
#endif
...
至于错误如下:
- 1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxstat_.h(172): error C2143: syntax error : missing ';' before '*'
- 1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxstat_.h(172): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxstat_.h(172): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h(112): fatal error C1189: #error : MFC requires use of Winsock2.h