大家帮忙看看这个连接错误,谢了

theCFan 2004-09-18 08:46:11
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/hello.exe : fatal error LNK1120: 2 unresolved externals
我是创建一个空白的win32项目工程里面加入了《深入浅出mfc》里p173的hello例子文件然后编译连接出现这样的错误的!在cmd环境下用书上的hello.mak编译连接则没有问题!是要将编译参数中的/MLd修改为/Md吗?但是每次修改后没有效果,它自动还原为/MLd!
...全文
117 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
theCFan 2004-09-18
  • 打赏
  • 举报
回复
我也看了!可总是领会不是很好!有些单词理解的不透彻,因而整体意思就掌握不是很好!没办法,还在学步呢
rivershan 2004-09-18
  • 打赏
  • 举报
回复
/MD, /ML, /MT, /LD (Use Run-Time Library)
Home | Overview | How Do I | Compiler Options

With these options, you can select either single-threaded or multithreaded run-time routines, indicate that a multithreaded module is a dynamic-link library (DLL), and select the retail or debug version of the library.

Note Having more than one copy of the run-time libraries in a process can cause problems, because static data in one copy is not shared with the other copy. To ensure that your process contains only one copy, avoid mixing static and dynamic versions of the run-time libraries. The linker will prevent you from linking with both static and dynamic versions within one .EXE file, but you can still end up with two (or more) copies of the run-time libraries. For example, a dynamic-link library linked with the static (non-DLL) versions of the run-time libraries can cause problems when used with an .EXE file that was linked with the dynamic (DLL) version of the run-time libraries. (You should also avoid mixing the debug and non-debug versions of the libraries in one process.)

Command Line Project Settings Description
/MD Multithreaded DLL Defines _MT and _DLL so that both multithread- and DLL-specific versions of the run-time routines are selected from the standard .H files. This option also causes the compiler to place the library name MSVCRT.LIB into the .OBJ file.
Applications compiled with this option are statically linked to MSVCRT.LIB. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCRT.DLL, which must be available at run time to applications linked with MSVCRT.LIB.
/MDd Debug Multithreaded DLL Defines _DEBUG, _MT, and _DLL so that debug multithread- and DLL-specific versions of the run-time routines are selected from the standard .H files. It also causes the compiler to place the library name MSVCRTD.LIB into the .OBJ file.
/ML Single-Threaded Causes the compiler to place the library name LIBC.LIB into the .OBJ file so that the linker will use LIBC.LIB to resolve external symbols. This is the compiler’s default action. LIBC.LIB does not provide multithread support.
/MLd Debug Single-Threaded Defines _DEBUG and causes the compiler to place the library name LIBCD.LIB into the .OBJ file so that the linker will use LIBCD.LIB to resolve external symbols. LIBCD.LIB does not provide multithread support.
/MT Multithreaded Defines _MT so that multithread-specific versions of the run-time routines are selected from the standard header (.H) files. This option also causes the compiler to place the library name LIBCMT.LIB into the .OBJ file so that the linker will use LIBCMT.LIB to resolve external symbols. Either /MT or /MD (or their debug equivalents /MTd or /MDd) is required to create multithreaded programs.
/MTd Debug Multithreaded Defines _DEBUG and _MT. Defining _MT causes multithread-specific versions of the run-time routines to be selected from the standard .H files. This option also causes the compiler to place the library name LIBCMTD.LIB into the .OBJ file so that the linker will use LIBCMTD.LIB to resolve external symbols. Either /MTd or /MDd (or their non-debug equivalents /MT or MD) is required to create multithreaded programs.
/LD Not applicable Creates a DLL.
Passes the /DLL option to the linker. The linker looks for, but does not require, a DllMain function. If you do not write a DllMain function, the linker inserts a DllMain function that returns TRUE.
Links the DLL startup code.
Creates an import library (.LIB), if an export (.EXP) file is not specified on the command line; you link the import library to applications that call your DLL.
Interprets /Fe as naming a DLL rather than an .EXE file; the default program name becomes basename.DLL instead of basename.EXE.
Changes default run-time library support to /MT if you have not explicitly specified one of the /M options
/LDd Not applicable Creates a debug DLL. Defines _DEBUG.


To find these options in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click Code Generation in the Category box. See the Use Run-Time Library drop-down box.

The debug options select the debug versions of the library or DLL and define _DEBUG. For more information on using the debug versions, see C Run-Time Debug Libraries.

For further discussion of DLLs, see DLL Topics.


--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
theCFan 2004-09-18
  • 打赏
  • 举报
回复
谢了!
weakwater 2004-09-18
  • 打赏
  • 举报
回复
楼上六颗星的大哥正解

六颗星 牛人
roger_ding 2004-09-18
  • 打赏
  • 举报
回复
如果手动改编译参数(显示在面板里的)可能不行,要用上面的界面操作来修改

lib有加入工程吗
bobob 2004-09-18
  • 打赏
  • 举报
回复
如果用到了mfc就要选use mfc in a share dll

ALT+F7,General里面
theCFan 2004-09-18
  • 打赏
  • 举报
回复
这是我编译时的参数:
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/hello.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /Md /GZ /c
theCFan 2004-09-18
  • 打赏
  • 举报
回复
能说详细一点吗?总是这一段不是很明白!郁闷!
老夏Max 2004-09-18
  • 打赏
  • 举报
回复
错了!是MDd
老夏Max 2004-09-18
  • 打赏
  • 举报
回复
MTd

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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