Saturday, July 18, 2009

Project Not Linked When Dependent Library Changes

I recently found a bug that was driving me nuts. If you have a project that depends on a separate .lib project, and you change the .lib but NOT the main project, when the main project builds it will correctly rebuild the .lib but will NOT re-link! This means your library changes are not included and you end up confusing both yourself and the debugger.

I use unit tests in a big way (a good thing) and tend to have core code in a .lib which is used by both the main application and the unit test project. One day last week a test failed so I fixed the code in the core lib and ran the tests EXE again ... which built the .lib but as it didn't link with it, the tests failed again. Cue much head scratching.

I posted this to the Qt Creator mailing list.

And at least one other user on the list was having a similar issue.

One suggested workaround was to add a PRE_TARGETDEPS line to the .pro file which I will try when I am back in the office.

No comments:

Post a Comment