Results 1 to 9 of 9

Thread: confused by difference bewteen setting debug/release in creator build and .pro

  1. #1
    Join Date
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Angry confused by difference bewteen setting debug/release in creator build and .pro

    I am building a .pro based Qt project using Qt creator. I really like Creator. But I am quite confused by the difference between setting the build in creator to debug/release and doing the same thing in the .pro file.

    Ideally I just want to set debug or release builds in creator and not to have to change the .pro file.

    If I put this in the .pro file:

    Qt Code:
    1. CONFIG = qt warn_on resources uic
    2.  
    3. TEMPLATE = app
    4.  
    5. win32 {
    6. QMAKE_CXXFLAGS += -EHsc
    7. debug {
    8. QMAKE_CXXFLAGS += -Gm
    9. }
    10. release {
    11. QMAKE_CXXFLAGS += -Zi -GL
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

    Then set the creator build to debug, it builds it with release setting (e.g. -O2). The build output is:

    qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010

    I also tried:

    qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010 "CONFIG+=debug"

    But it didn't seem to make any difference.

    I can only seem to get it to do what I want by setting "CONFIG=debug" in both the .pro file and the creator build. This makes changing between debug and release builds tedious.

    I have had a look through the qmake and creator documentation, but I couldn't find anything useful. I'm sure there must be a straightforward answer.

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

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    Try qmake -config debug
    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.


  3. #3
    Join Date
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    That didn't work either.

    I added:

    -config debug

    As additional args for the debug build in creator and left the .pro as:

    CONFIG = qt warn_on resources uic

    Notice the -O2 flags in the output, so it is still building as release:

    14:29:44: Running steps for project asg...
    14:29:44: Starting: "C:\Qt\4.8.3\bin\qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010 -config debug
    14:29:44: The process "C:\Qt\4.8.3\bin\qmake.exe" exited normally.
    14:29:44: Starting: "C:\Qt\qtcreator-2.5.2\bin\jom.exe"
    c:\Qt\4.8.3\bin\uic.exe MainWindow.ui -o ui_MainWindow.h
    c:\Qt\4.8.3\bin\uic.exe NewGameDialog.ui -o ui_NewGameDialog.h
    cl -c -nologo -Zm200 -Zc:wchar_t- -EHsc -O2 -MD -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.3\include\QtCore" -I"c:\Qt\4.8.3\include\QtGui" -I"c:\Qt\4.8.3\include" -I"." -I"c:\Qt\4.8.3\include\ActiveQt" -I"." -I"c:\Qt\4.8.3\mkspecs\win32-msvc2010" -Fo @C:\Users\andyb\AppData\Local\Temp\GameView.obj.60 60.0.jom

  4. #4
    Join Date
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    I found the answer on Stackoverflow. Looks like the answer is to do this in the .pro file:

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

    This seems to work , but Yuk! Surely there must be a more elegant way?

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

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    A more elegant way to do what exactly?
    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
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    Set CONFIG to 'debug' or 'release' from the Creator IDE, without having to modify the .pro file.

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

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    How did the pro file look like initially? I really have no problems in modifying CONFIG when invoking qmake
    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.


  8. #8
    Join Date
    Mar 2015
    Posts
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    The Release mode enables optimizations and generates without any debug data, so it is fully optimized. . Lots of your code could be completely removed or rewritten in Release mode. The resulting executable will most likely not match up with your written code. Because of this release mode will run faster than debug mode due to the optimizations. More about.....Debug and Release build

    Walsh

  9. #9
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: confused by difference bewteen setting debug/release in creator build and .pro

    Quote Originally Posted by AndyBrice View Post
    I can only seem to get it to do what I want by setting "CONFIG=debug" in both the .pro file and the creator build. This makes changing between debug and release builds tedious.
    Make sure your project is actually setup to use debug settings when you choose the debug build. Go to "Projects" in the left dock, make sure the Debug build configuration is chosen at the top of the screen and that your qmake setting is using CONFIG+=debug using the example below:


    qmake qaws.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64


    Hope that helps.

Similar Threads

  1. Difference between Debug and Release Mode
    By sunil.thaha in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2013, 13:31
  2. Difference names for dll of debug and release
    By alizadeh91 in forum Installation and Deployment
    Replies: 1
    Last Post: 16th December 2012, 23:17
  3. confused about QFileDialog in debug and release mode
    By furskytl in forum Qt Programming
    Replies: 4
    Last Post: 23rd December 2011, 11:01
  4. Replies: 2
    Last Post: 3rd October 2011, 23:04
  5. A difference between debug build with gcc and vc++
    By piotr.dobrogost in forum Qt Tools
    Replies: 12
    Last Post: 30th July 2009, 12:09

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.