Roger Peng
Roger Peng

Reputation: 11

How to combine two dependent projects in Visual Studio

I have a solution which has two projects. One is a static link library project, and another is a console project for demo. Now I want to create a MFC project to replace the console project, what should I do to configure the MFC project.

  1. the MFC project need to use some classes in the .lib project.
  2. I have set MFC project as start project and depend on the .lib project.
  3. My platform is win7 + vs2015.
  4. Actually, the solution is EasyPR, you can get it here EasyPR.

Thanks for any help.

Upvotes: 1

Views: 104

Answers (1)

xMRi
xMRi

Reputation: 15385

Setting the dependency to the static library is one step.

To compile the code you may need headers for the compiler. So the MFC projects may need settings for the compiler to define additional include paths.

You still need to configure the linker to use and find the library. To reference the library you may use a pragma comment lib. In the linker settings you may add an additional path for the libraries.

Or you may simply drag the lib into the solution explorer. The build mechanism will know how to treat a lib and will include it into the build process. The later will only work if you have 1 lib for release and debug.

If you have different libs for release and debug a advise you to use different names. You may adjust the project settings of the MFC program for debug and release differently.

Upvotes: 1

Related Questions