Results 1 to 12 of 12

Thread: Problem with QMake/UIC

  1. #1
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Problem with QMake/UIC

    I have been using SCONS for my build environment so far, and recently switched to qmake. I have yet to solve the following problem, and I couldn't find an answer in the forum search.

    uic is not executed on my ui files when I build. My .pro is as follows:

    Qt Code:
    1. TEMPLATE = app
    2. CONFIG = qt warn_on debug
    3. CONFIG += uic3
    4.  
    5. HEADERS = config.h frmMain.h tinystr.h tinyxml.h
    6.  
    7. SOURCES = frmMain.cpp main.cpp tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp
    8.  
    9. ;INCLUDEPATH += C:\\Qt\\4.1.1\\include
    10. ;INCLUDEPATH += C:\\postgresql\\include
    11.  
    12. LIBS += -lQtCore4 -lQtGui4 -lQtSql4 -lQtNetwork4
    13. win32 {
    14. LIBS += -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwsock32 -lws2_32
    15. }
    16. unix {
    17. ; SOURCES += hellounix.cpp
    18. }
    19.  
    20. FORMS += frmMain_template.ui
    21. INTERFACES += frmMain_template.ui
    22.  
    23. TARGET = hardupdater
    To copy to clipboard, switch view to plain text mode 

    I run the following:

    # qmake

    (This builds a Makefile)

    # make

    I am on a Ubuntu box with QT4, but the problem remains on both MingW/Windows/QT4 and Gentoo/QT4

    I have tried having only one or the other of FORMS/INTERFACES, and have tried both uic3 and uic4 under the config.

    I have also tried modifying the "expected" output header that I include from my .cpp file. With my SCONS build, I was including:

    #include "frmMain_template.h"

    From the output of a manually run uic, it seems that I might need to expect:

    #include "Ui_frmMain_template.h"

    One of the links I found through Google indicated that unless a .cpp file requires the corresponding header, UIC will not be run, but I have tried everything above to no success.

  2. #2
    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: Problem with QMake/UIC

    You don't need to add anything to config to have uic available. Uic generates files in form of "ui_formname.h" (with lowercase "u", which might be relevant for uic).

  3. #3
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    Quote Originally Posted by wysota View Post
    You don't need to add anything to config to have uic available. Uic generates files in form of "ui_formname.h" (with lowercase "u", which might be relevant for uic).
    uic is not being run at all. I modified my code this time to include "ui_frmmain_template.h", which based on what you said should be the filename, re-ran qmake, re-ran make, and uic is still not run on my .ui file. During compilation I get errors because ui_frmmain_template.h is not found.

  4. #4
    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: Problem with QMake/UIC

    Quote Originally Posted by hardgeus View Post
    uic is not being run at all. I modified my code this time to include "ui_frmmain_template.h", which based on what you said should be the filename, re-ran qmake, re-ran make, and uic is still not run on my .ui file. During compilation I get errors because ui_frmmain_template.h is not found.
    Try this project file:

    SOURCES+=main.cpp
    FORMS += form.ui

    And in main.cpp:
    Qt Code:
    1. #include "ui_form.h"
    2.  
    3. int main(){
    4. return 0;
    5. }
    To copy to clipboard, switch view to plain text mode 

    BTW. I think line 2 of your project file may be invalid. You write "CONFIG=..." instead of "CONFIG+=...".

  5. The following user says thank you to wysota for this useful post:

    hardgeus (28th February 2008)

  6. #5
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    Quote Originally Posted by wysota View Post
    BTW. I think line 2 of your project file may be invalid. You write "CONFIG=..." instead of "CONFIG+=...".
    Hmm...it turns out that's the problem. If I modify my first line to be CONFIG +=, then everything works as expected.

  7. #6
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    You also don't need all the LIBS += - it's just confusing

  8. #7
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    I don't know if it's considered bad form to bump old threads, but I figured I'd just continue this one since my issue is unchanged, and it is really affecting my ability to efficiently develop with QT. Apparently, I was only masking an underlying issue when I changed my .pro file as described above. Something weird is definitely happening.

    On my Ubuntu box, uic will run *only* if my config line has a += as follows:

    CONFIG += qt warn_off debug

    The "+" is the key to making it work. If I leave off the "+", uic will not run. Ever.

    To make matters even more confusing, on my Windows box, uic will only run if I have the "+" *and* I remove the first line:

    TEMPLATE = app

    Unfortunately, in Windows, if I remove this line uic will run but now my .exe is not built. On Linux, everything runs just fine without this line.

    My .pro is still as described above. What is going on? I have scoured documentation, and I cannot find anything that begins to explain this behavior.

    (Edited to add current .pro file)

    Qt Code:
    1. CONFIG += qt warn_off debug
    2.  
    3. HEADERS = frmAdministrative.h frmEvaluation.h frmLIneItem.h frmLocation.h frmLogin.h frmMain.h qtutil.h tinystr.h tinyxml.h xmlhandler.h jonconfig.h claimobject.h
    4.  
    5. SOURCES = frmAdministrative.cpp frmEvaluation.cpp frmLineItem.cpp frmLocation.cpp frmLogin.cpp frmMain.cpp main.cpp qtutil.cpp tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp xmlhandler.cpp jonconfig.cpp claimobject.cpp
    6.  
    7. INCLUDEPATH += C:\\Qt\\4.1.1\\include
    8. INCLUDEPATH += C:\\postgresql\\include
    9.  
    10. win32 {
    11. LIBS += -lQtCore4 -lQtGui4 -lQtSql4 -lQtNetwork4 -lQtXml
    12. LIBS += -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwsock32 -lws2_32
    13. LIBS += -ladvapi32
    14. }
    15. unix {
    16. LIBS += -lQtCore -lQtGui -lQtSql -lQtNetwork -lQtXml
    17. }
    18.  
    19.  
    20. INTERFACES += frmAdministrative_template.ui
    21. INTERFACES += frmEvaluation_template.ui
    22. INTERFACES += frmLineItem_template.ui
    23. INTERFACES += frmLocation_template.ui
    24. INTERFACES += frmLogin_template.ui
    25. INTERFACES += frmMain_template.ui
    26.  
    27. TARGET = estitrac
    To copy to clipboard, switch view to plain text mode 

  9. #8
    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: Problem with QMake/UIC

    You can't overwrite CONFIG as it contains declarations vital for Qt code to be built correctly. You can only add to it or remove from it.

    After having a quick look at the above file, it could be shortened to:

    txt Code:
    1. CONFIG += warn_off debug
    2.  
    3. HEADERS = frmAdministrative.h frmEvaluation.h frmLIneItem.h frmLocation.h \
    4. frmLogin.h frmMain.h qtutil.h tinystr.h tinyxml.h xmlhandler.h jonconfig.h claimobject.h
    5.  
    6. SOURCES = frmAdministrative.cpp frmEvaluation.cpp frmLineItem.cpp frmLocation.cpp frmLogin.cpp \
    7. frmMain.cpp main.cpp qtutil.cpp tinystr.cpp tinyxml.cpp tinyxmlerror.cpp \
    8. tinyxmlparser.cpp xmlhandler.cpp jonconfig.cpp claimobject.cpp
    9.  
    10. win32:INCLUDEPATH += C:/postgresql/include
    11.  
    12. QT += sql network xml
    13.  
    14. FORMS += frmAdministrative_template.ui frmEvaluation_template.ui frmLineItem_template.ui \
    15. frmLocation_template.ui frmLogin_template.ui frmMain_template.ui
    16.  
    17. TARGET = estitrac
    To copy to clipboard, switch view to plain text mode 

  10. The following user says thank you to wysota for this useful post:

    hardgeus (31st March 2008)

  11. #9
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    Your .pro file works fine for me in Ubuntu, but not in Windows.

    Using your .pro file, the uic does get executed properly. However, in Windows, no .exe file is generated at the last step. No errors are reported. Even if I add the "TEMPLATE = app" line, it still will not generate a .exe

  12. #10
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    OK, I am an idiot. I didn't see the debug\ and release\ subdirectories. The .exe is being generated, but the default directory structure is different on Windows. Is there documentation on how I can change where the binary is generated?

  13. #11
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with QMake/UIC

    See DESTDIR.
    J-P Nurmi

  14. The following user says thank you to jpn for this useful post:

    hardgeus (31st March 2008)

  15. #12
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMake/UIC

    OK, all is well with the world. Thanks, guys!

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.