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