新手请教,以下代码调式了一个晚上,还不能通过。为什么????????????????????????????????

fucool 2001-12-03 12:11:13

//Hello.cpp
#include <afxwin.h>

//
class CHelloFrame : public CFrameWnd
{
public:
CHelloFrame()
{Create(NULL, "Hello World",WS_OVERLAPPEDWINDOW,rectDefault);}
};

//
class ChelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};

//
bool ChelloApp::InitInstance()
{
m_pMainWnd = new ChelloFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
//
CHelloApp HelloApp;
...全文
141 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
fucool 2001-12-03
  • 打赏
  • 举报
回复
--------------------Configuration: hello World - Win32 Debug--------------------
Compiling...
hellp.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(21) : error C2556: 'bool __thiscall ChelloApp::InitInstance(void)' : overloaded function differs only by return type from 'int __thiscall ChelloApp::InitInstance(void)'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(16) : see declaration of 'InitInstance'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(21) : error C2371: 'InitInstance' : redefinition; different basic types
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(16) : see declaration of 'InitInstance'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(22) : error C2061: syntax error : identifier 'ChelloFrame'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(26) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

hello World.exe - 102 error(s), 0 warning(s)

有这么多,我晕倒了
Stepdev 2001-12-03
  • 打赏
  • 举报
回复
提示有什么错误?
fucool 2001-12-03
  • 打赏
  • 举报
回复
看来今晚是搞不定了
fucool 2001-12-03
  • 打赏
  • 举报
回复
好象没几个有在线了,没有看呀!!!!!!!!!!!11
fucool 2001-12-03
  • 打赏
  • 举报
回复
我是按教材一个一个打上去的,好象一字不差呀,唉!!!
huxianwei 2001-12-03
  • 打赏
  • 举报
回复
你一定要看:
这个程序我写过,主要因为这是一个MFC程序,但是你没有在工程中包含MFC类,解决方法是:Program/Setting/General/Microsoft Foundation Classes 中设定using mfc class,保证没错。
Jupiterrr 2001-12-03
  • 打赏
  • 举报
回复
bool ChelloApp::InitInstance()
{
m_pMainWnd = new ChelloFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
//
CHelloApp HelloApp;
是不是你定义倒了,在我的印象中应用程序对像应该是在InitInstance之前生成的。
lonelywwh 2001-12-03
  • 打赏
  • 举报
回复
to fucool:你能否把你的整个工程发过来我看看(要winzip过)my e_mail:wwh_zg@163.com
dog_dog 2001-12-03
  • 打赏
  • 举报
回复
study
lonelywwh 2001-12-03
  • 打赏
  • 举报
回复
to fucool:你能否把你的整个工程发过来我看看(要winzip过)
fucool 2001-12-03
  • 打赏
  • 举报
回复
--------------------Configuration: hellp - Win32 Debug--------------------
Compiling...
hellp.cpp
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/hellp.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

hellp.exe - 4 error(s), 0 warning(s)
这是为什么呀?
高手教我一下呀?
fucool 2001-12-03
  • 打赏
  • 举报
回复
--------------------Configuration: hellp - Win32 Debug--------------------
Compiling...
hellp.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(15) : error C2059: syntax error : '{'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(15) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(22) : error C2555: 'CHelloApp::InitInstance' : overriding virtual function differs from 'CWinApp::InitInstance' only by return type or calling convention
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(4031) : see declaration of 'CWinApp'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(29) : error C2460: 'HelloApp' : uses 'CHelloApp', which is being defined
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(12) : see declaration of 'CHelloApp'
C:\Program Files\Microsoft Visual Studio\MyProjects\hello World\hellp.cpp(30) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

hellp.exe - 5 error(s), 0 warning(s)
HoverInTheSky 2001-12-03
  • 打赏
  • 举报
回复
cHelloApp敲错了,别的好像没问题
ttzzgg_80713 2001-12-03
  • 打赏
  • 举报
回复
1----->bool != BOOL
2----->ChelloApp != CHelloApp
// end
leehq 2001-12-03
  • 打赏
  • 举报
回复
好像在构造类时不能开创窗口!

1,650

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧