How does one Create Managed C++ Static Library in Visual Studio (Error C1189)

老子叫甜甜 提交于 2020-01-07 02:17:05

问题


It seems it is not possible to create a static linked library in managed /CLR generated code. I started by creating a C++ /CLR Library which defaulted to a DLL Library. When I change it to Static library (.lib) I get the error:

C1189 "Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]"

I don't want to include MFC DLL. I have selected Use Standard Windows Libraries so not sure why it thinks I am building MFC application.

When I try to "not use /MD[d]" I find that all four options ( /MT /MTd /MD /MDd ) are incompatible with /CLR

D8015 /CLR and /MT command-line options are incompatible
D8015 /CLR and /MTd command-line options are incompatible
C1189 for both /MDd and /MD

Am I trying to do something that is just not possible in managed code. That is create a single managed code executable that doesn't require other external DLL files?

来源:https://stackoverflow.com/questions/12307324/how-does-one-create-managed-c-static-library-in-visual-studio-error-c1189

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