这个是什么问题呀?求指教error C2509: 'InitInstance' :

日期:2018.10.12 | 分类:数学

这个是什么问题呀?求指教


--------------------Configuration: root - Win32 Debug-------------------- Compiling... root.cpp C:\Program Files\Microsoft Visual Studio\MyProjects\root\root.cpp(37) : error C2509: 'InitInstance' : member function not declared in 'CRootApp'         c:\program files\microsoft visual studio\myprojects\root\root.h(17) : see declaration of 'CRootApp' 执行 cl.exe 时出错.

  • 补充:编译都通过,就是执行的时候报错!
  • 补充:root.cpp文件如下: // CRootApp initialization BOOL CRootApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization #ifdef _AFXDLL Enable3dControls();// Call this when using MFC in a shared DLL #else Enable3dControlsStatic();// Call this when linking to MFC statically #endif CRootDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { } else if (nResponse == IDCANCEL) { } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; } root.h 文件如下: // root.h : main header file for the ROOT application // #if !defined(AFX_ROOT_H__CED7E692_ACBB_4BDA_968D_90ADA22C2316__INCLUDED_) #define AFX_ROOT_H__CED7E692_ACBB_4BDA_968D_90ADA22C2316__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h"// main symbols class CRootApp : public CWinApp { public: CRootApp(); // Overrides // Implementation //{{AFX_MSG(CRootApp) //}}AFX_MSG DECLARE_MESSAGE_MAP() };
  • https://www.teaku.com/2793/1539335778210293.html

    最佳回答

    • OnLButtonDown你这是自己打上去的吧,其实可以用系统添加的,这个错是因为你CMyWnd class声明的时候里面没有OnLButtonDown,afx_msg void OnLButtonDowm(UINT nFlags,CPoint point);怎么打成m了,应该是n...OnLButtonDown

    其他回答

    • 如果你检查了确定没有语法错误,这种报错一般是文本里有编译器识别不了的字符,而且这玩意显示不出来,试试改变编译器的编码格式或者把文本用word打开显示所有的非文字字符看看