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
inttinstead ofint, but Qt Creator would continue compiling after the first line putting an error on the second line and the third line saying thatxis undefined. In this case it doesn't matter so much, but in real life, I would usexover 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?
-
How can I do that if my compiler is Visual Studio?
-
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 :( -
Half way there: Stop waiting on a failed build and it only took a decade.
In another one it will stop the current project too I'm sure :) -
I was brought up to use
make. A "sub-project" meant run a newmakerecursively from the makefile. If a compilation fails that returns a non-0 result to itsmakewhich then exits immediately returning non-0 to its parentmake. You then have the-symbol in a makefile command and/or the-kargument tomakefor further control.Worked, and worked fine, for a century. Why do they need to complicate stuff? ;-)