开发者

Multiple projects referencing MFC: "use mfc in a static library" vs "use mfc in a shared dll"?

Using Visual Studio 2010 C++. I have a project which uses MFC and I am statically linking to MFC. I am in the process of trying to extract the non-GUI functionality into a separate static library project. Because 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 projec开发者_如何转开发ts.

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


You don't need to link a library project, so there won't be an extra copy of MFC being linked in. You'll be creating a dependency on the MFC library from your static library, but that's normal. As long as the .exe project includes both libraries, everything will come out all right in the end.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜