title: Running a C++ Program on Mac in Visual Studio Code
body: <p>i am trying to run:</p>
  
  <pre><code>    #include &lt;iostream&gt;
  
  int main() {
      std::cout &lt;&lt; "Hello World!";
      return 0;
  }
  </code></pre>
  
  <p>on my Mac. I installed C++ and Code Runner in Visual Studio Code. But I get the following error:</p>
  
  <pre><code>[Running] cd "/Users/NAME/Documents/Program/C++/" &amp;&amp; g++ test.cpp -o test &amp;&amp; "/Users/NAME/Documents/Program/C++/"test Undefined symbols for architecture x86_64:   "_main", referenced from:
       implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
  
  [Done] exited with code=1 in 0.081 seconds
  </code></pre>