1

Imagine that scenario:

 L

 ^^

 | \

 |  D

 |  ^ 

 | /

  X

Where X is an executable, D is a DLL, an L is a Lib. The arrow means "depends on".

I made changes on source of L. When I tried to compile and run X, the code that was executing was the OLD code of L. That happens because, when linking X, it is absorbing D code first, and it sees that D already has that code of L, and will not link with new code of L.

I have the problem of not knowing what D's I need to rebuild. If I would make a graph of my code base, it would be a very complicated one with LOTS of dependencies. Is there a way to build the solutions that are dependencies to X? Or at least, to discover them.

Because, now I am solving this that way:

1) Try to know what are the dependencies to X manually. It is very annoying and uncertain. I fall many times on the situation I described on top.

2) I have a script that recompiles everything of my code base. There are lots and lots of solutions that have nothing to do with X. This takes lots of time and resources, unnecessarily.

IMPORTANT NOTE: The projects are on separate solutions and cannot be merged into only one. The code base is huge and we don't want to have less modularity on it.

4

1 回答 1

0

由于您表示无法编辑依赖项,因此我将退出 M$ 工具链并尝试使用 a g++,您只需为其提供 Visual Studio 项目中的包含路径。它有一个命令行开关,可以为给定的每个源文件生成一个make文件规则。这个 makefile 可以成为你所依赖的线索。

> g++ -I ./lib1 -MM *.cpp
x.o: x.cpp a.h lib1/lib1.h
y.o: y.cpp a.h

只要您只搜索 X 的直接依赖项,就可以了。如果你知道足够多的 gnu 工具,你可能能够sort找到依赖的路径,并且你已经准备好了:)。

然后,当然,您仍然需要为您的项目 X 填写这些依赖项。

也许为此使用cygwin是个好主意。或者一个mingw。

于 2013-01-24T18:54:50.797 回答