How can I turn on compiler warnings on Qt Creator?



  • Before I started using Qt Creator, I used g++ with the -Wall option to compile my projects. Is there a way to get warnings by default on every new project I make in Qt Creator?


  • Moderators

    Creator does not build your project, so you need to tell this to your build system. Projects created by Qt Creator will use qmake, so the simplest way to get this set for all projects going forward is to just edit the mkspec used. The mkspecs are found in QTDIR/mkspecs/. Do keep some backups;-)



  • Or, if it is just a single project, add <code>QMAKE_CXXFLAGS += -Wall</code> to your .pro.



  • [quote author="Tobias Hunger" date="1343235479"]Creator does not build your project, so you need to tell this to your build system. Projects created by Qt Creator will use qmake, so the simplest way to get this set for all projects going forward is to just edit the mkspec used. The mkspecs are found in QTDIR/mkspecs/. Do keep some backups;-)[/quote]
    This is a folder :/ How can I enable warnings in qmake?


  • Moderators

    giwrg98: Open the .conf file in that folder and add the flags you want to QMAKE_CXXFLAGS.

    Read the included files for more information on what is set up for you already.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.