【发布时间】:2014-06-23 09:59:43
【问题描述】:
我写了一个回调方法,当我尝试在vs2012中编译项目时,出现以下错误:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '&'
这两个错误都出现在同一行中。
这些是我正在尝试的以下代码:
#include <windows.h>
#include "atlstr.h"
///////////////////////////////////////////////////////////////////////////////
class CInf;
typedef BOOL (*PENUMDEVCALLBACK)(CInf* inf, const CString& devname, const CString& instsecname, const CStringArray& devid, PVOID context, DWORD& code);
我认为错误将出现在CStringArray& 参数中,因为当我包含afxcoll.h 时。
the fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>.
当我删除 windows.h 时。上述错误消失了,但我还需要 windows.h 标头。
知道如何在同一个文件中包含windows.h 和afxcoll.h。
【问题讨论】:
-
我相信你应该包括
afx.h然后afxcoll.h。前者(间接)包括windows.h
标签: windows visual-c++ visual-studio-2012 mfc