⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_30559.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:30559 发表者:titany 发表日期:2003-02-24 15:48:20
<br>主题:一个mfc"helloworld"程序链接出现问题,初学者求教,谢谢
<br>内容:编译没有错误,但链接出现了以下几个错误,我搞不懂怎么办才好,请大家帮帮忙吧<BR>--------------------Configuration: aaa - Win32 Debug--------------------<BR>Linking...<BR>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex<BR>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex<BR>libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main<BR>Debug/aaa.exe : fatal error LNK1120: 3 unresolved externals<BR>Error executing link.exe.<BR><BR>aaa.exe - 4 error(s), 0 warning(s)<BR><BR><BR>//hello.cpp<BR><BR>#include &lt;afxwin.h&gt;<BR><BR>// 说明应用程序类<BR>class CHelloApp : public CWinApp<BR>{<BR>&nbsp;&nbsp; public:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL InitInstance();<BR>};<BR><BR>// 建立应用程序类的实例<BR>CHelloApp HelloApp;<BR><BR>// 说明主窗口类<BR>class CHelloWindow : public CFrameWnd<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CStatic* cs;<BR>&nbsp;&nbsp;&nbsp;&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CHelloWindow();<BR>};<BR><BR>// 每当应用程序首次执行时都要调用的初始化函数<BR>BOOL CHelloApp::InitInstance()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMainWnd = new CHelloWindow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMainWnd-&gt;ShowWindow(m_nCmdShow);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMainWnd-&gt;UpdateWindow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;<BR>}<BR><BR>// 窗口类的构造函数<BR>CHelloWindow::CHelloWindow()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 建立窗口本身<BR>&nbsp;&nbsp;&nbsp;&nbsp;Create(NULL, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Hello World!", <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WS_OVERLAPPEDWINDOW, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CRect(0,0,200,200));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// 建立静态标签<BR>&nbsp;&nbsp;&nbsp;&nbsp;cs = new CStatic();<BR>&nbsp;&nbsp;&nbsp;&nbsp;cs-&gt;Create("hello world",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WS_CHILD|WS_VISIBLE|SS_CENTER,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CRect(50,80,150,150),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this);<BR>}<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:晚风也渡 回复日期:2003-02-24 15:50:28
<br>内容:你建立的是什么工程?应该建立win32 Application.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:titany 回复日期:2003-02-24 16:06:35
<br>内容:我改成win32 application工程的empty<BR>少了一个错误<BR>--------------------Configuration: aaaaa - Win32 Debug--------------------<BR>Linking...<BR>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex<BR>nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex<BR>Debug/aaaaa.exe : fatal error LNK1120: 2 unresolved externals<BR>Error executing link.exe.<BR><BR>aaaaa.exe - 3 error(s), 0 warning(s)<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:xiongli 回复日期:2003-02-24 16:13:00
<br>内容:用alt+f7,在link里面找到/subsystem:console<BR>把console改成windows
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:titany 回复日期:2003-02-24 16:25:06
<br>内容:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/aaaaa.pdb" /debug /machine:I386 /out:"Debug/aaaaa.exe" /pdbtype:sept <BR><BR>是windows的啊,还是有那三个错误,能不能说一下错误的原因?<BR>unresolved external symbol __endthreadex和线程有关???<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:晚风也渡 回复日期:2003-02-24 16:29:27
<br>内容:在菜单Project-&gt;Settings弹出的对话框中的Microsoft Foundation<BR>Classed选项中,不要选"Not Using MFC",选择后两个之一。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:titany 回复日期:2003-02-24 16:42:25
<br>内容:晚风能告诉我你是怎样发现错在这个地方的吗?我想知道为什么?谢谢^_^
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:晚风也渡 回复日期:2003-02-24 18:21:13
<br>内容:因为我曾经也遇到过这种问题。呵呵!<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:titany 回复日期:2003-02-24 21:40:38
<br>内容:呵呵,大眼美女你还挺坦诚嘛^_^
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:titany 回复日期:2003-02-24 21:42:06
<br>内容:谢谢你啦^_^
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:晚风也渡 回复日期:2003-02-24 22:03:55
<br>内容:没关系,记住就行了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:痛苦中 回复日期:2003-04-16 11:11:21
<br>内容:这篇文章让我受益很多.真的很感谢
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:和你在一起 回复日期:2003-06-07 21:53:13
<br>内容:我的程序:<BR>simpwin.h<BR><BR>LRESULT CALLBACK MainWndproc(HWND,UINT,WPARAM,LPARAM);<BR><BR>BOOL InitApplication(HINSTANCE);<BR>BOOL InitInstance(HINSTANCE,int);<BR><BR>char *hello="窗外的世界很精彩,窗口内的天地也很奇妙";<BR><BR>simpwin.c<BR><BR>#include&lt;windows.h&gt;<BR>#include&lt;string.h&gt;<BR>#include"simpwin.h"<BR><BR>HINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;hInst;<BR>HWND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hWndMain;<BR><BR>int APIENTRY WinMain(<BR>HINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;hInstance,<BR>HINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;hPrevInstance,<BR>LPSTR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lpCmdLine,<BR>int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nCmdShow)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;MSG msg;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!InitApplication(hInstance))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(FALSE);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!InitInstance(hInstance,nCmdShow))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(FALSE);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;while(GetMessage(&amp;msg,NULL,0,0))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TranslateMessage(&amp;msg);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DispatchMessage(&amp;msg);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return(msg.wParam);<BR>}<BR><BR>BOOL InitApplication(HINSTANCE hInstance)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;WNDCLASS wcSimpwin;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.style=0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.lpfnWndProc&nbsp;&nbsp;&nbsp;&nbsp;=(WNDPROC)MainWndproc;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.cbClsExtra&nbsp;&nbsp;&nbsp;&nbsp;=0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.cbClsExtra&nbsp;&nbsp;&nbsp;&nbsp;=0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.hInstance&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=hInstance;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.hIcon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=LoadCursor(NULL,IDI_APPLICATION);<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.hbrBackground&nbsp;&nbsp;&nbsp;&nbsp;=0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.lpszMenuName&nbsp;&nbsp;&nbsp;&nbsp;=NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;wcSimpwin.lpszClassName&nbsp;&nbsp;&nbsp;&nbsp;="WimpwinWClass";<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return(RegisterClass(&amp;wcSimpwin));<BR>}<BR><BR>BOOL InitInstance(<BR>HINSTANCE&nbsp;&nbsp;&nbsp;&nbsp;hInstance,<BR>int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nCmdShow)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;hInst=hInstance;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;hWndMain=CreateWindow(<BR>&nbsp;&nbsp;&nbsp;&nbsp;"SimpwinWClass",<BR>&nbsp;&nbsp;&nbsp;&nbsp;"我的窗口",<BR>&nbsp;&nbsp;&nbsp;&nbsp;WS_OVERLAPPEDWINDOW,<BR>&nbsp;&nbsp;&nbsp;&nbsp;CW_USEDEFAULT,CW_USEDEFAULT,<BR>&nbsp;&nbsp;&nbsp;&nbsp;CW_USEDEFAULT,CW_USEDEFAULT,<BR>&nbsp;&nbsp;&nbsp;&nbsp;NULL,NULL,hInstance,NULL);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!hWndMain)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(FALSE);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;ShowWindow(hWndMain,nCmdShow);<BR>&nbsp;&nbsp;&nbsp;&nbsp;UpdateWindow(hWndMain);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return(TRUE);<BR>}<BR><BR>LRESULT CALLBACK MainWndProc(<BR>HWND&nbsp;&nbsp;&nbsp;&nbsp;hWnd,<BR>UINT&nbsp;&nbsp;&nbsp;&nbsp;message,<BR>WPARAM&nbsp;&nbsp;&nbsp;&nbsp;wParam,<BR>LPARAM&nbsp;&nbsp;&nbsp;&nbsp;lParam)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;HDC&nbsp;&nbsp;&nbsp;&nbsp;hdc;<BR>&nbsp;&nbsp;&nbsp;&nbsp;PAINTSTRUCT&nbsp;&nbsp;&nbsp;&nbsp;ps;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;switch(message)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_PAINT:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hdc=BeginPaint(hWnd,&amp;ps);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TextOut(hdc,20,10,hello,lstrlen(hello));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EndPaint(hWnd,&amp;ps);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_DESTROY :<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PostQuitMessage(0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(DefWindowProc(hWnd,message,wParam,lParam));<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return(0);<BR>}<BR><BR>晚风妹妹,帮帮忙,我快让它折磨死了。<BR><BR><BR><BR>2003-6-7 21:55:41

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -