Several projects that link to MFC: "Use mfc in a static library" versus "Use mfc in a shared DLL"?

Using Visual Studio 2010 C ++. I have a project that uses MFC and am statically linking to MFC. I am trying to extract non-GUI functionality into a separate static library project. Since I want to use CStrings in my library project (debatable whether I should, but for the sake of argument), I now need to reference MFC in both my library and my exe projects.

My question is: if I statically link to MFC in my library project and in my exe project, can I effectively have two copies of MFC linked in my final exe? What if I added a third project, so I had several libraries linking to mfc? That sounds bad, but I'm not sure how to get around this.

+3
source share
1 answer

You do not need to link the library project, so no additional copy of MFC will be added to it. You will create a dependency on the MFC library on your static library, but this is normal. As long as the .exe project includes both libraries, in the end everything will be fine.

+2
source

All Articles