问题描述
我正在将.NET支持集成到我们的C ++应用程序中。这是一个旧式的MFC应用程序,其中有一个额外的文件用/ clr选项引用了CWinFormsControl。 p>
我不允许删除链接器标志/ NODEFAULTLIB。
(我们有自己的构建管理系统,不是Visual Studio的。
这意味着我必须指定所有必要的库:VC runtime和MFC。
其他编译器选项包括/ MD
旁边:我不能使用链接器标志/ FORCE:MULTIPLE,只需添加所有:
我如何解决它:
- 链接到/ FORCE:MULTIPLE / verbose(链接确定),并将输出设置为一条。
- NODEFAULTIB / verbose并跟踪上一步骤的输出中的所有未解析,并将库1添加到1.
- 这导致双重:AAA.lib:XXX已在BBB中定义。 lib
- 然后我终于得到了:
用/ MD
重新编译管理和非管理单元并链接到(其他)
mscoree.lib
msvcmrt.lib
mfcm80d.lib
混合/ MT(非托管)和/ MD out是不好的主意:
需要不同的(重叠)库。
@ajryan:Dependcy Walker只告诉我使用什么dll,当链接时链接到。
(例如msvcmrt.lib?)
我想。
感谢您的答案!
Jan
I'm integrating .NET support into our C++ application.
It's an old-school MFC application, with 1 extra file compiled with the "/clr" option that references a CWinFormsControl.
I'm not allowed to remove the linker flag "/NODEFAULTLIB".
(We have our own build management system, not Visual Studio's.)
This means I have to specify all necessary libraries: VC runtime and MFC.
Other compiler options include "/MD"
Next to that: I can't use the linker flag "/FORCE:MULTIPLE" and just add everything:
I'm looking for a non-overlapping set of libraries.
How I solved it:
- link with "/FORCE:MULTIPLE /verbose" (that links ok) and set the output aside.
- link with "/NODEFAULTIB /verbose" and trace all unresolveds in the output of the previous step and add the libraries 1 by 1.
- This resulted in doubles: "AAA.lib: XXX already defined in BBB.lib"
- Then I finally got it:Recompiled managed AND unmanaged units with /MDand link to (among others):mscoree.libmsvcmrt.libmfcm80d.lib
Mixing /MT (unmanaged) and /MD (managed) turned out to be the bad idea:different(overlapping) libraries are needed.
@ajryan: Dependcy Walker only tells me what dll's are used, not what libraries are linked to when linking.(e.g. msvcmrt.lib ?)I think.
Thanks for the answers!
Jan
这篇关于我需要什么库来链接我的混合模式应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!