请问,我错在哪里了,为什么链接会出错??急,求救
source:
// 07294.cpp : Defines the entry point for the application.
//#include "stdafx.h"
#include "07294.h"
#include "afxwin.h"#define MAX_LOADSTRING 100
//zj wrote
class sample:public CFrameWnd
{
public:
sample()
{
Create(NULL,L"MFC Window");
MessageBox(L"My Mfc",L"CFrame",MB_OK);
}
};
class App:public CWinApp
{
public:
BOOL InitInstance();
BOOL ExitInstance();};
BOOL App::InitInstance()
{
MessageBox(0,L"My MFC W",L"InitInstance",MB_OK|MB_ICONASTERISK);
sample *obj;
obj=new sample;
m_pMainWnd=obj;
obj->ShowWindow(SW_SHOWMAXIMIZED);
return TRUE;
}
BOOL App::ExitInstance()
{
MessageBox(0,L"MY Win",L"ExitInstance",MB_OK|MB_ICONHAND);
return TRUE;
}
App a;//zj wrote result:
1>Linking...
1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
1>uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___wargv
1>uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
1>d:\Visual Studio 2005\Projects\07294\Debug\07294.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://d:\Visual Studio 2005\Projects\07294\07294\Debug\BuildLog.htm"
1>07294 - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

解决方案 »

  1.   

    看样子像是没能准确包含DLL对应的LIB库
    看载入的路迳正确与否?
      

  2.   

    比如,双击如下这行;
    1>Linking... 
    1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRTD.lib(MSVCR80D.dll) 看看这个函数是在那个头文件定义的,然后再看看你有没有正确引入MSVCRTD.lib 和MSVCR80D.dll
    你是用什么版本的VC开发的? 
      

  3.   

    函数当中没有看到delete,却有这样的错误,那可能就是继承的问题。
    将BOOL InitInstance(); BOOL ExitInstance();改成:BOOL Virtual InitInstance(); BOOL Virtual ExitInstance();试试
      

  4.   

    不不,反了, virtual BOOL InitInstance();virtual BOOL ExitInstance();