level 1
我从教学上复制了一个mfc最基本的范例 helloapp
#include <afxwin.h>
// 说明应用程序类
class CHelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
// 建立应用程序类的实例
CHelloApp HelloApp;
// 说明主窗口类
class CHelloWindow : public CFrameWnd
{
CStatic* cs;
public:
CHelloWindow();
};
// 每当应用程序首次执行时都要调用的初始化函数
BOOL CHelloApp::InitInstance()
{
m_pMainWnd = new CHelloWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
// 窗口类的构造函数
CHelloWindow::CHelloWindow()
{
// 建立窗口本身
Create(NULL,
"Hello World!",
WS_OVERLAPPEDWINDOW,
CRect(0,0,200,200));
// 建立静态标签
cs = new CStatic();
cs->Create("hello world",
WS_CHILD|WS_VISIBLE|SS_CENTER,
CRect(50,80,150,150),
this);
}
可是编辑时产生的错误如下
1>------ 已开始建置: 专案: testaaaa, 组态: Debug Win32 ------
1>正在编译...
1>test.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>正在连结...
1>mfcs90d.lib(nolib.obj) : error LNK2019: 无法解析的外部符号 __imp__SysFreeString@4 在函式 "public: __thiscall ATL::CComBSTR::~CComBSTR(void)" (??1CComBSTR@ATL@@QAE@XZ) 中被参考
1>mfcs90d.lib(stdafx.obj) : error LNK2001: 无法解析的外部符号 __imp__SysFreeString@4
1>msvcrtd.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 _main 在函式 ___tmainCRTStartup 中被参考
1>msvcrtd.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 __imp__InterlockedExchange@8 在函式 ___tmainCRTStartup 中被参考
1>msvcrtd.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 __imp__Sleep@4 在函式 ___tmainCRTStartup 中被参考
1>msvcrtd.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 __imp__InterlockedCompareExchange@12 在函式 ___tmainCRTStartup 中被参考
1>msvcrtd.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 __imp__TerminateProcess@8 在函式 ___report_gsfailure 中被参考
1>msvcrtd.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 __imp__GetCurrentProcess@0 在函式 ___report_gsfailure 中被参考
1>msvcrtd.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 __imp__UnhandledExceptionFilter@4 在函式 ___report_gsfailure 中被参考
2010年04月10日 13点04分
1
level 1
1>msvcrtd.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 __imp__SetUnhandledExceptionFilter@4 在函式 ___report_gsfailure 中被参考
1>msvcrtd.lib(unhandld.obj) : error LNK2001: 无法解析的外部符号 __imp__SetUnhandledExceptionFilter@4
1>msvcrtd.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 __imp__IsDebuggerPresent@0 在函式 ___report_gsfailure 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2001: 无法解析的外部符号 __imp__IsDebuggerPresent@0
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__RaiseException@16 在函式 "int __cdecl DebuggerProbe(unsigned long)" (?DebuggerProbe@@YAHK@Z) 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__DebugBreak@0 在函式 "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z) 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__WideCharToMultiByte@32 在函式 "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z) 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__MultiByteToWideChar@24 在函式 "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z) 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__lstrlenA@4 在函式 "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被参考
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__GetProcAddress@8 在函式 "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2001: 无法解析的外部符号 __imp__GetProcAddress@8
1>msvcrtd.lib(_error_.obj) : error LNK2019: 无法解析的外部符号 __imp__LoadLibraryA@4 在函式 "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2001: 无法解析的外部符号 __imp__LoadLibraryA@4
1>msvcrtd.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__QueryPerformanceCounter@4 在函式 ___security_init_cookie 中被参考
1>msvcrtd.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetTickCount@0 在函式 ___security_init_cookie 中被参考
1>msvcrtd.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetCurrentThreadId@0 在函式 ___security_init_cookie 中被参考
1>msvcrtd.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetCurrentProcessId@0 在函式 ___security_init_cookie 中被参考
1>msvcrtd.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetSystemTimeAsFileTime@4 在函式 ___security_init_cookie 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__HeapFree@12 在函式 "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被参考
2010年04月10日 13点04分
2
level 1
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__HeapAlloc@12 在函式 "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__GetProcessHeap@0 在函式 "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__GetModuleFileNameW@12 在函式 "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__VirtualQuery@12 在函式 "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被参考
1>msvcrtd.lib(_pdblkup_.obj) : error LNK2019: 无法解析的外部符号 __imp__FreeLibrary@4 在函式 "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__CopyRect@8 在函式 "public: __thiscall CRect::CRect(struct tagRECT const &)" (??0CRect@@QAE@ABUtagRECT@@@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__IsRectEmpty@4 在函式 "public: int __thiscall CRect::IsRectEmpty(void)const " (?IsRectEmpty@CRect@@QBEHXZ) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__PtInRect@12 在函式 "public: int __thiscall CRect::PtInRect(struct tagPOINT)const " (?PtInRect@CRect@@QBEHUtagPOINT@@@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__SetRect@20 在函式 "public: void __thiscall CRect::SetRect(int,int,int,int)" (?SetRect@CRect@@QAEXHHHH@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__SetRectEmpty@4 在函式 "public: void __thiscall CRect::SetRectEmpty(void)" (?SetRectEmpty@CRect@@QAEXXZ) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__EqualRect@8 在函式 "public: int __thiscall CRect::EqualRect(struct tagRECT const *)const " (?EqualRect@CRect@@QBEHPBUtagRECT@@@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__InflateRect@12 在函式 "public: void __thiscall CRect::InflateRect(int,int)" (?InflateRect@CRect@@QAEXHH@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__OffsetRect@12 在函式 "public: void __thiscall CRect::OffsetRect(int,int)" (?OffsetRect@CRect@@QAEXHH@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__IntersectRect@12 在函式 "public: int __thiscall CRect::IntersectRect(struct tagRECT const *,struct tagRECT const *)" (?IntersectRect@CRect@@QAEHPBUtagRECT@@0@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__UnionRect@12 在函式 "public: int __thiscall CRect::UnionRect(struct tagRECT const *,struct tagRECT const *)" (?UnionRect@CRect@@QAEHPBUtagRECT@@0@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__SubtractRect@12 在函式 "public: int __thiscall CRect::SubtractRect(struct tagRECT const *,struct tagRECT const *)" (?SubtractRect@CRect@@QAEHPBUtagRECT@@0@Z) 中被参考
1>atlsd.lib(atltypes.obj) : error LNK2019: 无法解析的外部符号 __imp__MulDiv@12 在函式 "public: class CRect __thiscall CRect::MulDiv(int,int)const " (?MulDiv@CRect@@QBE?AV1@HH@Z) 中被参考
1>C:\Documents and Settings\WW\My Documents\Visual Studio 2008\Projects\testaaaa\Debug\testaaaa.exe : fatal error LNK1120: 40 个无法解析的外部符号
1>已将建置记录储存於 "file://c:\Documents and Settings\WW\My Documents\Visual Studio 2008\Projects\testaaaa\testaaaa\Debug\BuildLog.htm"
1>testaaaa - 46 个错误,0 个警告
========== 建置: 0 成功、1 失败、0 最新、0 略过 ==========
即使是在创建WIN32主控台应用程序 勾选加入通用标头档中的MFC选项且不加任何CODE依然会产生类似的错误 所以想请问各位前辈该如何解决
2010年04月10日 13点04分
3