gpt4 book ai didi

visual-c++ - 混合使用/MT 和/MD 编译的代码

转载 作者:行者123 更新时间:2023-12-04 06:40:48 27 4
gpt4 key购买 nike

我有大量代码,使用/MT 编译(即期望静态链接到 CRT)。我需要将它与使用/MD 构建的静态第三方库结合起来(即期望动态链接 CRT)。

理论上是否可以将两者链接成一个可执行文件而无需重新编译?

如果我与/nodefaultlib:msvcrt 链接,我最终会得到少量 undefined reference ,例如 __imp__wgetenv .我很想尝试在我自己的代码中实现这些功能,转发到 wgetenv等。这值得一试,还是我会直接遇到下一个问题?

不幸的是,我被禁止采取将第三方代码打包到单独的 DLL 中的简单选项:-/

最佳答案

不。/MT 和/MD 是互斥的。

All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (/MD, /MT, /LD).



Source

关于visual-c++ - 混合使用/MT 和/MD 编译的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3469841/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com