How to make Qt Creator stop compiling after the first error



  • I often make a small error which leads to a lot of other errors, so the program won't compile. But to fix my error, I only need to know the first error, not the other ones. For example, imagine I write the following code:

    intt x = 0;
    int y = x;
    return x + y;
    

    In this case, to fix the error, I only need to know that I wrote intt instead of int, but Qt Creator would continue compiling after the first line putting an error on the second line and the third line saying that x is undefined. In this case it doesn't matter so much, but in real life, I would use x over 100 times and Qt Creator would take several minutes to compile a code although it already knows that it won't succeed to compile.

    So my question is, is there a way to make Qt Creator stop compiling after the first error?



  • QtCreator is no compiler, only an IDE. Therefore you have to see whether the compiler you're using supports the feature you want. If this can be enabled via a compiler option, then it can be added to the .pro file using QtCreator.



  • How can I do that if my compiler is Visual Studio?



  • Well, check Visual Studio documentation for stop compiling at the first encountered error...


  • Moderators

    Visual Studio is an IDE (like Qt Creator). The compiler it uses is MSVC. Unfortunately it has no such option. There was a feature request for it on Microsoft's UserVoice site, but it was closed due to little interest.

    GCC (and MinGW) on the other hand has a switch for it that you can pass to the compiler in the .pro file: QMAKE_CXXFLAGS += -Wfatal-errors.
    So if you want that feature in MSVC you'll need to convince Microsoft to implement it :(


Log in to reply
 

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