问题
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:
- 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 /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