VS2017 a project depends on another project

vs in a project, if you want to reference another project which resources, such as file cpp, h header files, etc.,

The simplest is a project dependent on another project

First put renderings

This solution, there are two projects, and solutions must be the same name TwoProject main project, or will be error, suggesting that open .lib, it is also possible to change, and the solution configuration on the line, not discussed here the same project name and the default general solution is to implement the program

In the Test, the

test.h

test.cpp

Test can be found in the definition of a function that is simple sum, an adder function, where the use of static characteristics lib also here, it is the interface, as is more suitable for the project dependency.

Then look at:

TwoProject.h temporarily need to define

TwoProject.cpp

TwoProject.cpp method called sum of Test.cpp

Always remember: TwoProject.cpp sure to include Test.h

Then look at the configuration file,

As a Test Project, Configuration Properties - "General, configure the type to static libraries (.lib)

As TwoProject project configuration as the application type (.exe) do not need to change, but to achieve the following two points

1) Directory test.h introduced (according to each person, depending on the specific, so #include <Test.h> valid)

2) adding test.cpp file, as shown below, to find test.cpp existing item, and then introduced into

Then run it, complete

Guess you like

Origin blog.csdn.net/blood_ing_/article/details/90019729