看看你自己生成的头文件是否重复include了重点怀疑这两个文件:
#include "DataSource.h"
#include "Add.h"在头文件中这么搞一下可以避免重复include:#ifndef __YOURHEADFILE_H__ //自己起个名字
#define __YOURHEADFILE_H__ ...//头文件内容#endif
#include "DataSource.h"
#include "Add.h"在头文件中这么搞一下可以避免重复include:#ifndef __YOURHEADFILE_H__ //自己起个名字
#define __YOURHEADFILE_H__ ...//头文件内容#endif
{
public:
CAboutDlg();// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
这段代码CAboutDlg里已经有了,我给删除了又出现如下错误
Compiling...
testDlg.cpp
f:\vc++\msdev98\myprojects\数字播种机\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
c:\documents and settings\administrator\桌面\重要 test 05.20 改进的欧氏距离 成功\重要 test 05.20 改进的欧氏距离 成功\testdlg.cpp(148) : error C2065: 'CAboutDlg' : undeclared identifier
c:\documents and settings\administrator\桌面\重要 test 05.20 改进的欧氏距离 成功\重要 test 05.20 改进的欧氏距离 成功\testdlg.cpp(148) : error C2146: syntax error : missing ';' before identifier 'dlgAbout'
c:\documents and settings\administrator\桌面\重要 test 05.20 改进的欧氏距离 成功\重要 test 05.20 改进的欧氏距离 成功\testdlg.cpp(148) : error C2065: 'dlgAbout' : undeclared identifier
c:\documents and settings\administrator\桌面\重要 test 05.20 改进的欧氏距离 成功\重要 test 05.20 改进的欧氏距离 成功\testdlg.cpp(149) : error C2228: left of '.DoModal' must have class/struct/union type
执行 cl.exe 时出错.testDlg.obj - 1 error(s), 0 warning(s)
但是你不要乱删
可以先屏蔽一个CAboutDlg的相关代码看看
不行再处理另一个
tcpkfDlg.obj : error LNK2005: "protected: virtual void __thiscall CAboutDlg::DoDataExchange(class CDataExchange *)" (?DoDataExchange@CAboutDlg@@MAEXPAVCDataExchange@@@Z) already defined in tcpfwDlg.obj
tcpkfDlg.obj : error LNK2005: "protected: static struct AFX_MSGMAP const * __stdcall CAboutDlg::_GetBaseMessageMap(void)" (?_GetBaseMessageMap@CAboutDlg@@KGPBUAFX_MSGMAP@@XZ) already defined in tcpfwDlg.obj
tcpkfDlg.obj : error LNK2005: "protected: virtual struct AFX_MSGMAP const * __thiscall CAboutDlg::GetMessageMap(void)const " (?GetMessageMap@CAboutDlg@@MBEPBUAFX_MSGMAP@@XZ) already defined in tcpfwDlg.obj
tcpkfDlg.obj : error LNK2005: "protected: static struct AFX_MSGMAP const CAboutDlg::messageMap" (?messageMap@CAboutDlg@@1UAFX_MSGMAP@@B) already defined in tcpfwDlg.obj
tcpkfDlg.obj : error LNK2005: "private: static struct AFX_MSGMAP_ENTRY const * const CAboutDlg::_messageEntries" (?_messageEntries@CAboutDlg@@0QBUAFX_MSGMAP_ENTRY@@B) already defined in tcpfwDlg.obj
tcpfwDlg.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall newsock::~newsock(void)" (??1newsock@@UAE@XZ)
tcpfwDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall newsock::newsock(void)" (??0newsock@@QAE@XZ)
Debug/tcpkf.exe : fatal error LNK1120: 2 unresolved externals
执行 link.exe 时出错.