title: Debugging C using Visual Studio Code on Windows
body: <p>I'm trying to debug a C program using Visual Studio Code on Windows 10,
  which I have the <strong>C/C++</strong> extension installed in.</p>
  
  <p>My problem is that when I create <code>Source.c</code> in my workspace ( <code>E:\Docs\c</code> ), write some code then hit <strong>F5</strong>, it shows an error message <code>launch: program 'E:\Docs\c\a.exe' does not exist</code>, which means VSCode doesn't do the compiling thing.</p>
  
  <p>Meanwhile when I go to the console and type <code>gcc source.c</code>, which creates <code>a.exe</code> in the same folder, and hit <strong>F5</strong> again it starts with no problems, but doing that every time I want to run the code is annoying.</p>
  
  <p>So, is there a way to compile the code from inside VSCode ?</p>
  
  <p>Here is my <code>c_cpp_properties.json</code> :</p>
  
  <pre><code>{
      "configurations": [
          {
              "name": "Win32",
              "includePath": [
                  "${workspaceFolder}",
                  "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.1.0\\include"
              ],
              "defines": [
                  "_DEBUG",
                  "UNICODE",
                  "_UNICODE"
              ],
              "intelliSenseMode": "msvc-x64"
          }
      ],
      "version": 4
  }
  </code></pre>
  
  <p>And this is <code>launch.json</code> : </p>
  
  <pre><code>{
      "version": "0.2.0",
      "configurations": [
          {
              "name": "(gdb) Launch",
              "type": "cppdbg",
              "request": "launch",
              "program": "${workspaceFolder}/a.exe",
              "args": [],
              "stopAtEntry": false,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": true,
              "MIMode": "gdb",
              "miDebuggerPath": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gdb.exe",
              "setupCommands": [
                  {
                      "description": "Enable pretty-printing for gdb",
                      "text": "-enable-pretty-printing",
                      "ignoreFailures": true
                  }
              ]
          }
      ]
  }
  </code></pre>