Creating & using an MFC static library
Is it possible to create an MFC static library (.lib) and link it to a non-MFC C++ application? If so, does anyon开发者_如何学运维e know how to create an MFC static library? Visual Studio doesn't seem to have any templates like that.
Well, it turns out that there is a template for an MFC static library; it's just well hidden—it's in the Win32 templates instead of the MFC templates.
All you have to do is create a standard Win32 project and choose "Static library". At that point the MFC checkbox is enabled and you're good to go.
MFC also comes as static library. Try creating an MFC project and experiment with project settings. You can also link it to non-MFC project. See generated stdafx file - it includes all needed headers plus does linking via preprocessor directive
精彩评论