Results 1 to 6 of 6

Thread: Why don't Qt Creator projects recompile after header changes?

  1. #1
    Join Date
    Aug 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Why don't Qt Creator projects recompile after header changes?

    With the last 2 incarnations of Qt for Windows I've used, 4.6 and SDK 1.1, I've noticed that editing a header file does not trigger recompilation of unchanged sources that include it. This is true with both the Gnu and MSVC tool chains in SDK 1.1. It leads to various errors, not all of which are caught by the linker. So I have to 'rebuild all' quite often to get a working program. I am not using precompiled headers.

    I wonder if this is a true bug, or if it can be fixed by some configuration setting I am not aware of?

    -- Tom

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Why don't Qt Creator projects recompile after header changes?

    Qmake generates makefiles that include header files as dependencies (direct or indirect inclusion) of the object (.o) file for me (Qt 4.7.2 on Linux and 4.6.2/4.7.0 in the 2010.02/2010.05 SDK for Windows). Consequently, touching one of the headers will recompile the source to get the object.

    Can you provide a small example that does not work for you?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Why don't Qt Creator projects recompile after header changes?

    It is important that you add your header files to the HEADERS variable in the project description.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Aug 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why don't Qt Creator projects recompile after header changes?

    I only have a quite large example now. All of my header files are named in the project file's HEADERS variable.

    Just to provoke thought, here is a piece of a Makefile for my big project:
    debug\test-v1_main.obj: ..\panini-test\test-v1_main.cpp ..\panini-test\test-v1_window.h \
    ..\panini-test\test-v1_view.h

    debug\test-v1_window.obj: ..\panini-test\test-v1_window.cpp ..\panini-test\test-v1_window.h \
    ..\panini-test\test-v1_view.h

    debug\test-v1_view.obj: ..\panini-test\test-v1_view.cpp ..\panini-test\test-v1_view.h

    debug\HermiteSpline.obj: ..\..\Panini-Core\src\HermiteSpline.c

    debug\splinemap.obj: ..\..\Panini-Core\src\splinemap.cpp

    debug\slidewindow.obj: ..\..\Panini-Core\src\slidewindow.cpp

    debug\paninilens.obj: ..\..\Panini-Core\src\paninilens.cpp

    debug\lensdbdialog.obj: ..\..\Panini-Core\src\lensdbdialog.cpp ui_lensdbdialog.h

    debug\CameraDBDialog.obj: ..\..\Panini-Core\src\CameraDBDialog.cpp ui_CameraDBDialog.h

    debug\slidearray.obj: ..\..\Panini-Core\src\slidearray.cpp

    debug\vnslide.obj: ..\..\Panini-Core\src\vnslide.cpp
    All of these sources have corresponding .h files, however only a few of those are explicitly given as dependencies in the makefile. Whether there is a moc file is not decisive; for example test_v1_window has a moc, as do most of the other sources whose headers are not mentioned; but test_v1_main, HermiteSpline and splinemap do not have mocs.

    Apparently the problem is that (in most cases) neither the dependency on the original header, nor on the moc file, is given. That would seem to be a QMake bug (or could it be a feature?).

    -- Tom

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Why don't Qt Creator projects recompile after header changes?

    As far as I know they don't have to be given explicitly in the Makefile as gcc is used to detect dependencies during compilation. I have no problems with dependencies in my projects and some of them are quite large and complicated.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Oct 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Why don't Qt Creator projects recompile after header changes?

    I've encountered the same issue. Building on Windows using Qt 4.7. I've added a few simple classes to my project and if I modified a header file, the cpp files using them do not get compiled. Headers are listed under the Headers folders and were created by Qt when I created the class. And my compiler is Visual Studio 2005.
    Last edited by dbradley; 19th October 2011 at 17:30.

Similar Threads

  1. Replies: 2
    Last Post: 7th September 2010, 21:19
  2. Qt Linguist Is it possible to recompile only the tools?
    By PaladinKnight in forum Qt Tools
    Replies: 2
    Last Post: 7th September 2010, 18:21
  3. Qt Creator USe Qt Creator for windows mobile projects
    By BenPa in forum Qt Tools
    Replies: 2
    Last Post: 15th February 2010, 14:42
  4. MSVC2K5 recompile /MT(d)
    By musikit in forum Installation and Deployment
    Replies: 2
    Last Post: 16th April 2008, 12:57
  5. How to recompile
    By vishesh in forum Newbie
    Replies: 1
    Last Post: 24th February 2007, 14:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.