我自己编了一个VC小程序,里面用了DBGrid和RomoteData,MSComm控件。
编译时都没错,但是运行时出现如下错误:
Debug Assertion Failed!
PROGRAM: E:\MYVVPRC\SERIALCOMM\DEBUG\SERIALCOMM.EXE
File: objcore.cpp
Line:43Fir information on how your program can cause an assertion failure, see the Visual C++
documention on assers.
(Press Retry to debug the application)
编译时都没错,但是运行时出现如下错误:
Debug Assertion Failed!
PROGRAM: E:\MYVVPRC\SERIALCOMM\DEBUG\SERIALCOMM.EXE
File: objcore.cpp
Line:43Fir information on how your program can cause an assertion failure, see the Visual C++
documention on assers.
(Press Retry to debug the application)
原代码如下:
/设置串口
void CSerialComnView::OnButton2()
{
// TODO: Add your control notification handler code here
CSetPortDlg myport;
myport.m_strSettings=_T("9600,n,8,1");
m_mscomm.SetSettings(myport.m_strSettings);
m_mscomm.SetCommPort(1);
if (m_mscomm.GetPortOpen())
AfxMessageBox("Port is already open!");
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.#include "stdafx.h"#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// export WinMain to force linkage to this moduleextern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow);extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{ // call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
在调试窗口Watch中出现如下错误:
Name: this
Value: CXX0017: Error: symbol "this" not found