What libraries do I need to link my mixed-mode application to?

試著忘記壹切 提交于 2019-12-11 10:24:32

问题


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.


回答1:


As a bare minimum:

mscoree.lib MSVCRT.lib mfc90.lib (adjust version appropriately)

And iterate from there.




回答2:


Use the AppWizard to create a bare-bones MFC app in your style (SDI / MDI / dialog ) and then put on your depends.




回答3:


How I solved it:

  1. link with "/FORCE:MULTIPLE /verbose" (that links ok) and set the output aside.
  2. link with "/NODEFAULTIB /verbose" and trace all unresolveds in the output of the previous step and add the libraries 1 by 1.
  3. This resulted in doubles: "AAA.lib: XXX already defined in BBB.lib"
  4. Then I finally got it: Recompiled managed AND unmanaged units with /MD and link to (among others): mscoree.lib msvcmrt.lib mfcm80d.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



来源:https://stackoverflow.com/questions/9570/what-libraries-do-i-need-to-link-my-mixed-mode-application-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!