title: Debugging c++ built with a makefile in Visual Studio Code
body: <p>I have an existing code base that builds with a makefile and I'd like to use Visual Studio Code to run it.</p>
  
  <p>I started by opening my project directory with Visual Studio Code.
  Then, for building I created a task as per <a href="http://code.visualstudio.com/docs/languages/cpp" rel="noreferrer">http://code.visualstudio.com/docs/languages/cpp</a> :</p>
  
  <pre><code>{
      "version": "0.1.0",
      "command": "bash",
      "isShellCommand": true,
      "args":["-c", "cd build &amp;&amp; make"]
  }
  </code></pre>
  
  <p>which works fine. I then downloaded the C++ extension and created a launch.json:</p>
  
  <pre><code>{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "C++ Launch",
          "type": "cppdbg",
          "request": "launch",
          "targetArchitecture": "x64",
          "program": "${workspaceRoot}/build/myProgram",
          "args": [],
          "stopAtEntry": false,
          "cwd": "${workspaceRoot}",
          "environment": [],
          "externalConsole": true,
          "linux": {
              "MIMode": "gdb"
          },
          "osx": {
              "MIMode": "lldb"
          },
          "windows": {
              "MIMode": "gdb"
          }
      },
      // attach here, which I don't care about
  ]
  }
  </code></pre>
  
  <p>This launch file allows me to start my program using the built-in debugger. I know that it works because I see all the symbol files getting loaded and I can pause the program.</p>
  
  <p>However, VS Code doesn't "see" my source files; when I pause it says </p>
  
  <pre><code> Source /Unknown Source is not available.
  </code></pre>
  
  <p>I also can't set breakpoints in the source. I see that <em>some</em> symbols get loaded though as I can see my function names on the call stack when I pause execution.</p>
  
  <p>So what did I miss? Do I absolutely have to do as they say here ( <a href="http://code.visualstudio.com/docs/languages/cpp" rel="noreferrer">http://code.visualstudio.com/docs/languages/cpp</a> ) and make a g++ task where I'll have to manually input all my include paths and linker inputs? The point of using a makefile in the first place was to not have to do this tedious stuff...</p>
  
  <p>Thanks a lot to anyone who knows how to wrangle VS code.</p>