1

I have a C program which uses a small part of the Gandalf C Machine Vision Library. There are thousands of source files. Some are includes (both .h and .c) and some are dependent in the linker stage.

I don't want to have a monolithic library. I would like to include in my source tree only the include and source files that are required. My test project is in VS2010, but I'm open to all options.

Is there a tool that I can use to detect both the include and source file dependencies?

This question is the closest I could find, but it's asking only to find all header file dependencies:

Automatically discovering C dependencies

Community
  • 1
  • 1
Adam Casey
  • 949
  • 2
  • 8
  • 24

2 Answers2

3

Klocwork has an On-the-Fly source code analysis product which can figure out redundant and unused header file. Have a look to see if it fulfills your requirements.

Aditya Naidu
  • 1,362
  • 9
  • 12
  • There appears to be a free trial; but I'm sure it's expensive. Plus, the tools in the linked question can find unused headers; it's the headers and source I am looking to find. Thanks for the recommendation; I may give it a free trial and see how it works. – Adam Casey Jun 03 '12 at 03:14
1

I have used checkheaders to find redundant #include's in the past and it's free.

As for source (object) file dependencies, this is a hard problem to solve. I have trolled the corners of the internet to find such a tool but to no avail. This question summarises one way you could do it by writing your own tool.

Community
  • 1
  • 1
thegreendroid
  • 3,239
  • 6
  • 31
  • 40