如何调试:对重载函数的歧义调用 [英] how to debug :-ambiguous call to overload function
本文介绍了如何调试:对重载函数的歧义调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误C2668:对重载函数的模棱两可的调用
该项目由几个活动的x控件组成,并带有以太网连接代码.
出现上述错误,并警告已声明多个构造函数.
ERROR C2668: ambiguous call to overload function
this project consists of few active x controls, with Ethernet connectivity code along with it.
the above error appears along with a warning that multiple constructors are declared.
// SSDU_DISPLAYView.cpp : implementation of the CSSDU_DISPLAYView class
//
#include "stdafx.h"
#include "SSDU_DISPLAY.h"
#include "CntrItem.h"
#include "SSDU_DISPLAYView.h"
#include "SSDU_DISPLAYDoc.h"
#include "EthernetSock.h"
#include "artHorizon2.h"
#include "logscale.h"
#include "verticalscale.h"
#include "rotmeter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CDC* pDCWnd;
HWND hwnd;
/////////////////////////////////////////////////////////////////////////////
// CSSDU_DISPLAYView
IMPLEMENT_DYNCREATE(CSSDU_DISPLAYView,CFormView)//<---------- ERROR HERE
BEGIN_MESSAGE_MAP(CSSDU_DISPLAYView,CFormView)
//{{AFX_MSG_MAP(CSSDU_DISPLAYView)
ON_WM_DESTROY()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_COMMAND(ID_OLE_INSERT_NEW, OnInsertObject)
ON_COMMAND(ID_CANCEL_EDIT_CNTR, OnCancelEditCntr)
ON_WM_TIMER()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSSDU_DISPLAYView construction/destruction
CSSDU_DISPLAYView::CSSDU_DISPLAYView()
: CFormView(CSSDU_DISPLAYView::IDD)
{
//{{AFX_DATA_INIT(CSSDU_DISPLAYView)
m_airspeed = _T("");
m_machno = _T("");
m_radioalt = _T("");
m_chcksum = _T("");
//}}AFX_DATA_INIT
m_pSelection = NULL;
// TODO: add construction code here
m_airspeed = "1188";
m_chcksum = "1.83";
m_machno = "1.01";
m_radioalt = "R1338";
}
CSSDU_DISPLAYView::~CSSDU_DISPLAYView()
{
}
void CSSDU_DISPLAYView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSSDU_DISPLAYView)
DDX_Control(pDX, IDC_BARO, m_baro);
DDX_Text(pDX, IDC_AIR_SPEED, m_airspeed);
DDX_Control(pDX, IDC_ARTHORIZONCTRL3, m_ahrzn);
DDX_Control(pDX, IDC_LOGSCALECTRL1, m_lscale);
DDX_Text(pDX, IDC_MACH_NO, m_machno);
DDX_Control(pDX, IDC_ROTMETERCTRL1, m_rotmeter);
DDX_Control(pDX, IDC_VERTICALSCALECTRL1, m_vscale);
DDX_Text(pDX, IDC_RADIO_ALT, m_radioalt);
DDX_Text(pDX, IDC_CHECKSUM, m_chcksum);
//}}AFX_DATA_MAP
}
BOOL CSSDU_DISPLAYView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CSSDU_DISPLAYView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// GetParentFrame()->RecalcLayout();
// ResizeParentToFit();
// TODO: remove this code when final selection model code is written
OnConnect();
m_pSelection = NULL; // initialize selection
}
/////////////////////////////////////////////////////////////////////////////
// CSSDU_DISPLAYView printing
BOOL CSSDU_DISPLAYView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSSDU_DISPLAYView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSSDU_DISPLAYView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CSSDU_DISPLAYView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}
void CSSDU_DISPLAYView::OnDestroy()
{
// Deactivate the item on destruction; this is important
// when a splitter view is being used.
CFormView::OnDestroy();
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
}
/////////////////////////////////////////////////////////////////////////////
// OLE Client support and commands
BOOL CSSDU_DISPLAYView::IsSelected(const CObject* pDocItem) const
{
// The implementation below is adequate if your selection consists of
// only CSSDU_DISPLAYCntrItem objects. To handle different selection
// mechanisms, the implementation here should be replaced.
// TODO: implement this function that tests for a selected OLE client item
return pDocItem == m_pSelection;
}
void CSSDU_DISPLAYView::OnInsertObject()
{
// Invoke the standard Insert Object dialog box to obtain information
// for new CSSDU_DISPLAYCntrItem object.
COleInsertDialog dlg;
if (dlg.DoModal() != IDOK)
return;
BeginWaitCursor();
CSSDU_DISPLAYCntrItem* pItem = NULL;
TRY
{
// Create new item connected to this document.
CSSDU_DISPLAYDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pItem = new CSSDU_DISPLAYCntrItem(pDoc);
ASSERT_VALID(pItem);
// Initialize the item from the dialog data.
if (!dlg.CreateItem(pItem))
AfxThrowMemoryException(); // any exception will do
ASSERT_VALID(pItem);
if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
pItem->DoVerb(OLEIVERB_SHOW, this);
ASSERT_VALID(pItem);
// As an arbitrary user interface design, this sets the selection
// to the last item inserted.
// TODO: reimplement selection as appropriate for your application
m_pSelection = pItem; // set selection to last inserted item
pDoc->UpdateAllViews(NULL);
}
CATCH(CException, e)
{
if (pItem != NULL)
{
ASSERT_VALID(pItem);
pItem->Delete();
}
AfxMessageBox(IDP_FAILED_TO_CREATE);
}
END_CATCH
EndWaitCursor();
}
// The following command handler provides the standard keyboard
// user interface to cancel an in-place editing session. Here,
// the container (not the server) causes the deactivation.
void CSSDU_DISPLAYView::OnCancelEditCntr()
{
// Close any in-place active item on this view.
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
{
pActiveItem->Close();
}
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
// Special handling of OnSetFocus and OnSize are required for a container
// when an object is being edited in-place.
void CSSDU_DISPLAYView::OnSetFocus(CWnd* pOldWnd)
{
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL &&
pActiveItem->GetItemState() == COleClientItem::activeUIState)
{
// need to set focus to this item if it is in the same view
CWnd* pWnd = pActiveItem->GetInPlaceWindow();
if (pWnd != NULL)
{
pWnd->SetFocus(); // don''t call the base class
return;
}
}
CFormView::OnSetFocus(pOldWnd);
}
void CSSDU_DISPLAYView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
pActiveItem->SetItemRects();
}
/////////////////////////////////////////////////////////////////////////////
// CSSDU_DISPLAYView diagnostics
#ifdef _DEBUG
void CSSDU_DISPLAYView::AssertValid() const
{
CFormView::AssertValid();
}
void CSSDU_DISPLAYView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CSSDU_DISPLAYDoc* CSSDU_DISPLAYView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSSDU_DISPLAYDoc)));
return (CSSDU_DISPLAYDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSSDU_DISPLAYView message handlers
void CSSDU_DISPLAYView::OnDraw(CDC* pDC)
{
CSSDU_DISPLAYDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CBrush br_background(pDoc->BKColour);
CRect client_rect;
GetClientRect(&client_rect);
hwnd = GetSafeHwnd();
pDC->FillRect(&client_rect,&br_background);
CString temp;
int j,k;
for(j=0,k=800;j<20,k<820;j++,k++)
{
temp.Format("%d",k);
m_baro.InsertString(j,temp);
}
m_baro.SetCurSel(10);
SetTimer(1,3000,NULL);
for(int i=0;i<3;i++)
{
m_ahrzn.Newvalues(5,0);
Sleep(250);
m_vscale.scaleValue(1);
Sleep(150);
m_lscale.updateval(2);
Sleep(150);
m_rotmeter.rvalue(10);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(10,10);
Sleep(250);
m_vscale.scaleValue(8);
Sleep(150);
m_lscale.updateval(10);
Sleep(150);
m_rotmeter.rvalue(5);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(15,20);
Sleep(250);
m_vscale.scaleValue(11);
Sleep(150);
m_lscale.updateval(-2);
Sleep(150);
m_rotmeter.rvalue(28);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(17,30);
Sleep(250);
m_vscale.scaleValue(15);
Sleep(150);
m_lscale.updateval(-12);
Sleep(150);
m_rotmeter.rvalue(10);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(-17,10);
Sleep(250);
m_vscale.scaleValue(20);
Sleep(150);
m_lscale.updateval(-30);
Sleep(150);
m_rotmeter.rvalue(6);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(-10,-23);
Sleep(250);
m_vscale.scaleValue(22);
Sleep(150);
m_lscale.updateval(20);
Sleep(150);
m_rotmeter.rvalue(35);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(-18,-30);
Sleep(250);
m_vscale.scaleValue(1);
Sleep(150);
m_lscale.updateval(25);
Sleep(150);
m_rotmeter.rvalue(10);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(8,8);
Sleep(250);
m_vscale.scaleValue(9);
Sleep(150);
m_lscale.updateval(-40);
Sleep(150);
m_rotmeter.rvalue(2.5);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(13,-25);
Sleep(250);
m_vscale.scaleValue(30);
Sleep(150);
m_lscale.updateval(22);
Sleep(150);
m_rotmeter.rvalue(20.50);
Sleep(150);
UpdateWindow();
//*************************
m_ahrzn.Newvalues(5,30);
Sleep(250);
m_vscale.scaleValue(19);
Sleep(150);
m_lscale.updateval(50);
Sleep(150);
m_rotmeter.rvalue(33);
Sleep(150);
UpdateWindow();
}
}
void CSSDU_DISPLAYView::OnConnect()
{
}
void CSSDU_DISPLAYView::OnRecieve()
{
char *pBuf = new char[1025];
int iBufSize = 1024;
int iRcvd;
CString strRcvd;
iRcvd = m_sConnectSock.Receive(pBuf,iBufSize);
UpdateData(TRUE);
if(iRcvd == SOCKET_ERROR)
{
//MessageBox("Not Recieved Any Messages");
}
else
{
// Truncate the end of the message
pBuf[iRcvd] = NULL;
// Copy the message to a CString
strRcvd = pBuf;
}
}
void CSSDU_DISPLAYView::Onclose()
{
m_sConnectSock.Close();
KillTimer(1);
}
void CSSDU_DISPLAYView::OnTimer(UINT nIDEvent)
{
OnRecieve();
//TODO: Add your message handler code here and/or call default
CFormView::OnTimer(nIDEvent);
}
在IMPLEMENT_DYNACREATE出现错误POINTS
请帮助我调试此问题
Error POINTS at IMPLEMENT_DYNACREATE
please help me to debug this problem
推荐答案
请报告完整的错误消息(您可能还会丢弃许多不相关的代码),并带有警告和CSSDU_DISPLAYView
声明.
:)
Please report the complete error message (you may also discard a lot of irrelevant code) with the warnings and theCSSDU_DISPLAYView
declaration.
:)
这篇关于如何调试:对重载函数的歧义调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文