Results 1 to 5 of 5

Thread: Qt Project How to ?

  1. #1
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Qt Project How to ?

    Could someone help me write a .pro file that by default compiles in both release and debug mode. In release mode. I don't want the debug message from qDebug() to get printed

    I tried some thing like this. But to no avail

    Qt Code:
    1. TEMPLATE = app
    2. TARGET = Driver
    3.  
    4. DESTDIR = ../Bin
    5.  
    6. CONFIG += qt \
    7. plugin \
    8. warn_on \
    9. debug_and_release \
    10. build_all
    11.  
    12. UI_DIR = Build/Ui
    13. MOC_DIR = Build/Moc
    14. OBJECTS_DIR = Build/Obj
    15.  
    16. CONFIG( debug, debug|release ) {
    17. CONFIG += console #show console in Windows platform
    18. CONFIG -= app_bundle #console in MAC also
    19. unix: TARGET = $$join( TARGET,,,_debug)
    20. else: TARGET = $$join( TARGET,,d)
    21. }
    22.  
    23. release {
    24. DEFINES += QT_NO_DEBUG_OUTPUT
    25. }
    26. INCLUDEPATH = ../Common/Include \
    27. ../Plugins/Include
    28.  
    29. DEPENDPATH += ../Common/Include \
    30. ../Plugins/Include
    31.  
    32. #HEADERS +=
    33.  
    34. SOURCES += Src/main.cpp
    To copy to clipboard, switch view to plain text mode 
    Last edited by sunil.thaha; 1st February 2007 at 13:26. Reason: reformatted to look better
    We can't solve problems by using the same kind of thinking we used when we created them

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Project How to ?

    Try this:
    Qt Code:
    1. CONFIG += debug_and_release
    2.  
    3. CONFIG( release, debug|release ) {
    4. DEFINES += RELEASE
    5. }
    6.  
    7. CONFIG( debug, debug|release ) {
    8. DEFINES += DEBUG
    9. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Project How to ?

    Sorry I did not get you ?
    We can't solve problems by using the same kind of thinking we used when we created them

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Project How to ?

    If you run qmake on that .pro file, you'll two Makefiles, which look like this:

    Makefile.Debug:
    ...
    DEFINES = -DDEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    ...
    Makefile.Release:
    ...
    DEFINES = -DRELEASE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    ...
    Now you can replace DEFINES += xxx with whatever you want.

  5. #5
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Project How to ?

    with CONFIG += debug_and_release

    In Qt 4.1.4 running qmake && make; compiles the project in debug mode
    where as in Qt 4.3.0, the Makefile generated runs the Makefile.Release by default, can I force it use the Makefile.debug
    Last edited by sunil.thaha; 9th August 2007 at 11:02. Reason: updated contents
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. how do i use a same project in multiple systems ?
    By nhatkhang in forum KDE Forum
    Replies: 6
    Last Post: 21st December 2006, 16:32
  2. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43
  3. Clean project deletes makefile
    By Djony in forum Qt Programming
    Replies: 2
    Last Post: 7th December 2006, 10:15
  4. Replies: 2
    Last Post: 11th July 2006, 14:19
  5. Qt project with mingw & Dev-C++ IDE
    By MarkoSan in forum Installation and Deployment
    Replies: 10
    Last Post: 19th April 2006, 12:42

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.