Visual Studio: executable link

Let's say I have: a static library project called "LIB" an application project called "LIBAPP" an application project called "APP" an application project called "APPTEST"

When I add LIB to LIBAPP Project Dependencies, Visual Studio automatically associates "LIBAPP" with LIB. But when I add APP to the dependencies of the APPTEST project, it does not.

Since I do unit tests of APP classes in APPTEST, I have to reference APP, so I am currently manually linking to all * .obj APP files (hundreds ...)

Since I have to change APPTEST link targets every time I add or remove a * .cpp file from APP, this is not a good solution.

So, is there a way to get Visual Studio to do this automatically for me, for example, when adding the Project Dependency static library?

+3
source share
2 answers

You cannot β€œlink to APP” as you have discovered.

One solution is to put all the APP code in its own library, leaving the APP as a single source file that performs the function in that library. You can make APPTEST another single source file that is associated with the new APP library.

+1
source

, ( ) . APP, , , , - "LIBAPPUTIL" , LIB APP LIB, LIBAPPUTIL.

. LIBAPP , :

  • LIBAPP void main() s
  • LIBAPPUTIL, .
  • LIBAPPUTIL, LIB. ( ++-, C-, poointers), APP LIB.
0

Source: https://habr.com/ru/post/1742316/


All Articles