VS2010 c++ 错误的处理
[来源] 达内 [编辑] 达内 [时间]2012-08-30
1错误:
fatalerror C1010: unexpected end of file while looking for precompiled header. Didyou forget to add '#include "StdAfx.h"' to your source?
解决: #include"StdAfx.h" 你把这个放在头文件里面就行了
2 vc++编程出现错误error C2447: missingfunction header (old-style formal list?)
原因:函数后面多了分号;
SUNSHINE_APISSN_RETURN SsnWriteProfileString(__in INT nPlugInId, __in_opt LPTSTRlpszGroupName, __in LPTSTR lpszKey, __in LPTSTR lpszValue);
3 error C2491: 'SsnWriteProfileString' : definitionof dllimport function not allowed
错误C2491:“SsnWriteProfileString’:dllimport函数的定义不允许的
SUNSHINE_API SSN_RETURNSsnWriteProfileString(__in INT nPlugInId, __in_opt LPTSTR lpszGroupName, __inLPTSTR lpszKey, __in LPTSTR lpszValue)
查看SUNSHINE_API在 .h文件中的定义
#ifdefSSNAPI_EXPORTS
#define SUNSHINE_API __declspec(dllexport)
#else
#define SUNSHINE_API __declspec(dllimport)
#endif
将#ifdef SSNAPI_EXPORTS添加到#include
#include
#defineSSNAPI_EXPORTS
则解决;
4 error C2065: “CString”: 未声明的标识符
在非mfc下使用CString会导致上面错误:
解决办法:
(1)那么:使用MFC:包含cstringt.h;不使用MFC:包含atlstr.h
(2)或者#include
5 error C2065: 'DEBUG_NEW' : undeclared identifier?
删除 .cpp 文件中的
#ifdef _DEBUG
#undef THIS_FILE
static charTHIS_FILE[]=__FILE__;
#define newDEBUG_NEW
#endif