Re: Unable to link (static MFC)



I think I need to use /MT switch instead of /MD
I will try with that!

Ashutosh wrote:
Hi,
Thanks all for your help/comments! :)

I library that I have to link with my project doesn't have a project file. It uses makefiles(its very complex)

Can you please tell me where to change the settings for linking MFC statically. Actually, I don't think that this library is using MFC (99.99% sure).

I checked the options for 'cl.exe' and 'link.exe' but found no options for that.

the flags being used for cl are

/MD /Ox /O2 /Ob2 /W3 /WX /Gs0 /GF /Gy /nologo -I"C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include" -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_SEED -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_TLSEXT -DOPENSSL_NO_CMS -DOPENSSL_NO_KRB5 -DOPENSSL_NO_DYNAMIC_ENGINE


and for linker it's

/nologo /subsystem:console /opt:ref /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib"

If this library/dll is not using MFC then what needs to be done so that it doesn't create any problem when used in another project which links MFC statically?


Regards,
Ashutosh

Charles Wang [MSFT] wrote:
Hi Ashutosh,
I understand that you encountered the link error when you build the third party library in statically link.
If I have misunderstood, please let me know.

From the error message, it is a common seen issue. You do not need to exclude libcmt.lib from linking. I recommend that you check if all the dependency projects or libraries are compiled with the same setting /MT[d]. Ensure that all of them have one setting here. You can find this setting at Project Properties->Configuration Properties-> C/C++ -> Code Generation-> Runtime Library.

For more information, you may refer to this article:
Linking to MFC/CRT dynamically and statically in one image http://blogs.msdn.com/nikolad/archive/2005/01/28/362778.aspx

Hope this helps. If you have any other questions or concerns, please feel free to let me know.
Best regards,
Charles Wang
Microsoft Online Community Support
===========================================================
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@xxxxxxxxxxxxxx
===========================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif

ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
============================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=========================================================

.



Relevant Pages

  • Re: Unable to link (static MFC)
    ... If this library/dll is not using MFC then what needs to be done so that it doesn't create any problem when used in another project which links MFC statically? ... We welcome your comments and suggestions about how we can improve the support we provide to you. ... Please feel free to let my manager know what you think of the level of service provided. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.vc.mfc)
  • Re: Add User to Local Group using WMI?
    ... I explored ways to deal with local group management about 4-5 years and the only built-in solution then was the WinNT provider. ... Microsoft Online Community Support ... You can send feedback directly to my manager at: ... initial response from the community or a Microsoft Support Engineer within ...
    (microsoft.public.win32.programmer.wmi)
  • RE: How can I install SQL Server Managment Studio (2005)?
    ... Did you choose "Management Toos" in the Advanced option during your setup process? ... Microsoft Online Community Support ... Please feel free to let my manager ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.sqlserver.setup)
  • RE: Hide Attributes without completely hiding Dimension Members
    ... Unfortunately SSAS 2005 does not provide such function in such a thin granular level. ... Microsoft Online Community Support ... Please feel free to let my manager ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.sqlserver.olap)
  • Re: Unable to open msg store if first prompt for password canceled
    ... I am performing research on this issue and may need more time to get back to you. ... We welcome your comments and suggestions about how we can improve the support we provide to you. ... Please feel free to let my manager know what you think of the level of service provided. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.win32.programmer.messaging)