title: How to use visual studio code to compile multi-cpp file?
body: <p>I have followed some instructions to construct Visual studio code C/C++ compile and debug environment.But g++ compiler can only compile the selected cpp file, so the included .h file associated the cpp file can not compiled. then the terminal shows 'Undefined symbols for architecture x86_64' error. the code as below:</p>
  
  <h1>the a.h file</h1>
  
  <pre><code>    int func();
  </code></pre>
  
  <h1>the a.cpp file</h1>
  
  <pre><code>    include &lt;iostream&gt;
      include "a.h"
      using namespace std;
      int func(){
          return 111;
      }
  </code></pre>
  
  <h1>the main.cpp file</h1>
  
  <pre><code>    include "a.h"
      using namespace std;
      int main()
      {
          int b = func();
          cout &lt;&lt; b &lt;&lt; endl;
      }
  </code></pre>
  
  <p>Visual studio code will use the command as below</p>
  
  <pre><code>     g++ directory/main.cpp -o directory/main.out -g -Wall -fcolor-        diagnostics -std=c++11
  </code></pre>
  
  <p>this command will raise 'Undefined symbols for architecture x86_64' error 
  I can fix it with this new command </p>
  
  <pre><code>    g++ main.cpp a.cpp -o main.out.
  </code></pre>
  
  <p>So the problem is how to config these json files to fix the g++ compile issue. And when I want to use some libraries such as FFMpeg, how can I link the FFMpeg .h file correctly.</p>