It is okay to use MFC in the shared library for the project. The following problem occurs when you use MFC in a static library.
1> msvcrtd. lib (ti_inst.obj): error LNK2005: "private: _ thiscall type_info: type_info (class type_info const &)"(?? 0type_info @ AAE @ ABV0 @ Z) has been defined in libcmtd. lib (typinfo. obj)
1> msvcrtd. lib (ti_inst.obj): error LNK2005: "private: class type_info & _ thiscall type_info: operator = (class type_info const &)"(?? 4type_info @ AAEAAV0 @ ABV0 @ Z) has been defined in libcmtd. lib (typinfo. obj)
1> msvcrtd. lib (MSVCR100D. dll): error LNK2005: _ wcsrchr has been defined in libcmtd. lib (wcsrchr. obj)
1> libcmtd. lib (crt0init. obj): warning LNK4098: the default library "msvcrtd. lib" conflicts with other libraries. Use/NODEFAULTLIB: library
1> G: \ MFCProjiect \ VideoLog \ Debug \ VideoLog.exe: fatal error LNK1169: locate one or more symbols with multiple definitions
I checked it online and said that a default library should be ignored.
After libcmtd. lib is ignored
1> Strmbasd. lib (mtype. obj): warning LNK4075: Ignore "/EDITANDCONTINUE" (due to the "/OPT: ICF" Specification)
1> uafxcw. lib (appcore. obj): error LNK2001: an external symbol that cannot be parsed ___ wargv
1> uafxcw. lib (appcore. obj): error LNK2001: external symbol that cannot be parsed ___ argc
1> G: \ MFCProjiect \ VideoLog \ Release \ VideoLog.exe: fatal error LNK1120: 2 external commands that cannot be parsed
1>
1> generation failed.
After msvcrtd. lib is ignored
1> Strmbasd. lib (mtype. obj): warning LNK4075: Ignore "/EDITANDCONTINUE" (due to the "/OPT: ICF" Specification)
1> Strmbasd. lib (wxdebug. obj): error LNK2001: external symbol that cannot be parsed _ imp ___ vsnwprintf
1> Strmbasd. lib (wxdebug. obj): error LNK2001: external symbol that cannot be parsed _ imp ___ vsnprintf
1> G: \ MFCProjiect \ VideoLog \ Release \ VideoLog.exe: fatal error LNK1120: 2 external commands that cannot be parsed
1>
1> generation failed.
Solution:
Define _ afxdll, project-> seting-> C/C ++-> Preprocessor-> DEFINE _ afxdll in Preprocessor. If the error message "Fatal error c1189: # error: please use the/MD switch for _ afxdll builds" appears, modify the following code: c/C ++-> code generation-> multithread DLL (Implementation/MD option)
Solve the problem and close the work.
Or use MFC in the shared library.