c++中这个程序怎么改正?
#include"stdafx.h"#include"sample0601.h"#include"MainFrm.h"#include"sample0601Doc.h"#...
#include "stdafx.h"
#include "sample0601.h"
#include "MainFrm.h"
#include "sample0601Doc.h"
#include "sample0601View.h"
#include "Login.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CSample0601App, CWinApp)
//{{AFX_MSG_MAP(CSample0601App)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
CSample0601App::CSample0601App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
CSample0601App theApp;
BOOL CSample0601App::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
CLogin m_login;
if(m_login.DoModal()==IDOK)
{
if(m_login.m_name=="123" && m_login.m_pwd==123)
{
MessageBox(NULL,"登陆成功","成功",MB_ICONINFORMATION|MB_OK);
}
else
{
MessageBox(NULL,"用户名或密码错误","错误",MB_ICONERROR|MB_OK);
return FALSE;
}
}
else
{
return FALSE;
}
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings();
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSample0601Doc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CSample0601View));
AddDocTemplate(pDocTemplate);
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
D:\Microsoft Visual Studio\MyCpp\sample0601\sample0601.cpp(46) : error C2039: 'm_name' : is not a member of 'CLogin' 展开
#include "sample0601.h"
#include "MainFrm.h"
#include "sample0601Doc.h"
#include "sample0601View.h"
#include "Login.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CSample0601App, CWinApp)
//{{AFX_MSG_MAP(CSample0601App)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
CSample0601App::CSample0601App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
CSample0601App theApp;
BOOL CSample0601App::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
CLogin m_login;
if(m_login.DoModal()==IDOK)
{
if(m_login.m_name=="123" && m_login.m_pwd==123)
{
MessageBox(NULL,"登陆成功","成功",MB_ICONINFORMATION|MB_OK);
}
else
{
MessageBox(NULL,"用户名或密码错误","错误",MB_ICONERROR|MB_OK);
return FALSE;
}
}
else
{
return FALSE;
}
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings();
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSample0601Doc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CSample0601View));
AddDocTemplate(pDocTemplate);
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
D:\Microsoft Visual Studio\MyCpp\sample0601\sample0601.cpp(46) : error C2039: 'm_name' : is not a member of 'CLogin' 展开
3个回答
2011-11-07
展开全部
你应该把错误提示贴出来,代码那么长,而且只是一个.cpp中。不好确定错误所在啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是的 把错误说出来么
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
shocking
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询