News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

dependency checking again ....

Started by simonl, December 01, 2008, 06:04:53 PM

Previous topic - Next topic

simonl

I know this was aired sometime back but the answers didn't really address the issue.  Suppose a.cpp contains #include <b.h> and b.h contains #include <c.h>.  A change to c.h may require a.cpp be be rebuilt even though neither a.cpp nor b.h have changed.

Using make directly I can deal with this by automatically generating the complete dependencies (see e.g.  http://make.paulandlesley.org/autodep.html - though in practice the gcc -M option isn't as convenient as I'd like or http://en.wikipedia.org/wiki/Makedepend) making the build detect a program needs to be rebuilt rather than expecting the programmer to plow through everything to sort out dependencies.

As far as I can see C::B doesn't do this ... or does/can it?

Simon

Jenna

Can you create a simple test-project where the problem occurs ?

I created a test project, where main.cpp includes test.h and test.h includes test_2.h.
test_2.h is not part of my project, but test.h is.
Inside test_2.h I have a function printing on stdout.

If I now change test_2.h the appropriate part of the program gets recompiled and the output is as expected.

simonl

Embarassing apology - I couldn't see why it didn't work for me until I realised C::B doesn't save open changed files before building.  When I remembered to save the file I'd modified, the build did detect the change.

I'm really impressed with C::B - and the support is so rapid.  No more Eclipse or NetBeans for me.

Sorry to have wasted your time.


Simon

Jenna

Quote from: simonl on December 01, 2008, 09:59:56 PM
Embarassing apology - I couldn't see why it didn't work for me until I realised C::B doesn't save open changed files before building.  When I remembered to save the file I'd modified, the build did detect the change.

If the file is not saved, it is included into the project to be build.

C::B normally saves all project-files (at least sources and headers) before building.