title: How to prevent the debugger from running after build failure in VS Code?
body: <p>I want the debugger not to be started when there are compilation errors in the code. This situation occurs when I have a successful build, then I make some changes that do not compile, and when I am launching the debugger, build fails, but the debugger is still launched with an old executable.</p>
  <p>I know about <code>Features -&gt; Debug -&gt; On task errors</code> option, but it does not change this behavior.</p>
  <p>I have the latest version of VS Code on Windows, standard C++ extension and mingw.
  This is my pretty much standard configuration:</p>
  <p><code>.code-workspace</code></p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;folders&quot;: [
          {
              &quot;path&quot;: &quot;..&quot;
          }
      ],
      &quot;settings&quot;: {
          &quot;debug.onTaskErrors&quot;: &quot;abort&quot;
      }
  }
  </code></pre>
  <p><code>launch.json</code></p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;version&quot;: &quot;0.2.0&quot;,
      &quot;configurations&quot;: [
          {
              &quot;name&quot;: &quot;g++.exe - debug&quot;,
              &quot;type&quot;: &quot;cppdbg&quot;,
              &quot;request&quot;: &quot;launch&quot;,
              &quot;program&quot;: &quot;${fileDirname}\\${fileBasenameNoExtension}.exe&quot;,
              &quot;args&quot;: [],
              &quot;stopAtEntry&quot;: false,
              &quot;cwd&quot;: &quot;${fileDirname}&quot;,
              &quot;environment&quot;: [],
              &quot;externalConsole&quot;: false,
              &quot;MIMode&quot;: &quot;gdb&quot;,
              &quot;miDebuggerPath&quot;: &quot;D:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe&quot;,
              &quot;setupCommands&quot;: [
                  {
                      &quot;text&quot;: &quot;-enable-pretty-printing&quot;,
                      &quot;ignoreFailures&quot;: true
                  }
              ],
              &quot;preLaunchTask&quot;: &quot;C/C++: g++.exe debug build&quot;
          },
      ]
  }
  </code></pre>
  <p><code>tasks.json</code></p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;version&quot;: &quot;2.0.0&quot;,
      &quot;tasks&quot;: [
          {
              &quot;type&quot;: &quot;cppbuild&quot;,
              &quot;label&quot;: &quot;C/C++: g++.exe debug build&quot;,
              &quot;command&quot;: &quot;D:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe&quot;,
              &quot;args&quot;: [&quot;-std=c++17&quot;,&quot;-Wall&quot;,&quot;-Wextra&quot;,&quot;-D&quot;,&quot;LOCAL&quot;,&quot;-g&quot;,&quot;${file}&quot;,&quot;-o&quot;,
                  &quot;${fileDirname}\\${fileBasenameNoExtension}.exe&quot;
              ],
              &quot;options&quot;: {
                  &quot;cwd&quot;: &quot;${fileDirname}&quot;
              },
              &quot;problemMatcher&quot;: [
                  &quot;$gcc&quot;
              ],
              &quot;group&quot;: {
                  &quot;kind&quot;: &quot;build&quot;,
                  &quot;isDefault&quot;: true
              },
              &quot;detail&quot;: &quot;compiler: \&quot;D:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe\&quot;&quot;
          },
      ]
  }
  </code></pre>
  <p>What else do I need to do?</p>