询问编译错误原因?
最近我下载了一个程序,里面没有发现__beginthreadex和__endthreadex的定义或者引用,
但在编译时却发生如下的错误:
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/FileChange.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
我想知道这是为什么,如何对它进行修改呢?
谢谢!
问题点数:30、回复次数:4Top
1 楼a8e(坎坷的菜贩)回复于 2000-09-13 17:53:00 得分 10
下载的程序?是不是只有源文件,而缺少某些工程文件,所以你新建一Win32 application工程,再将源文件加入工程编译?如果这样的话,需要用Alt-F7重新设置编译方式,将Not using MFC改为use MFC in a shared DLL就OK了。Top
2 楼bigjim(飞翔鸟)回复于 2000-09-14 08:50:00 得分 10
Msdn的q124666详细阐述了这个问题。下面是其中的一部分。
CAUSE
Starting with version 3.0, all MFC classes are "thread safe" and require the multi-threaded run-time libraries to link successfully. Many people try to use the single-threaded run-time libraries because they assume these libraries are needed to enable the application to run in Win32s. This is not the case. MFC versions 3.0 and later will use a single thread, so as long as you are not creating additional threads in the application, the application will run under Win32s.
RESOLUTION
To avoid these unresolved external errors, do not set the Project Settings to Single-Threaded for an MFC version 3.0 or later application. This setting can be changed by doing the following:
On Visual C 2.x and 5.0:
Select the PROJECT menu (and continue Steps 2 through 5 below).
On Visual C 4.x:
Select the Build menu.
Select the SETTINGS... option.
Select the tab, C/C++.
Select CODE GENERATION on the Category list box.
Finally, make a selection other than SINGLE-THREADED on the Use Run Time Library list box.
应该看懂了吧,那么,把单线程该为多线程试试。Top
3 楼600000(前 DOS 高手)回复于 2001-10-17 10:18:26 得分 10
凑个热闹!
我以前也碰到过,也想知道!
Up 一下!Top
4 楼No9(华龙)回复于 2001-10-19 11:48:32 得分 0
算了,这个问题已经没有用了!
谢谢三位的参与,分数平分了吧!Top
5 楼No9(华龙)回复于 2001-10-19 11:49:25 得分 0
开始加分!Top




