title: How do I make Golang CGO to use g++ linker for a c++ static library with extern "C" wrapper
body: <p>I am trying to make CGO link my C++ static library with GO code. I have written a C-wrapper header and c-source file with  extern &quot;C&quot; calls
  like this</p>
  <pre><code>#ifdef __cplusplus
  extern &quot;C&quot; {
  #endif
  </code></pre>
  <p>and have added  <code>-stdc++</code> to the <code>LDFLAGS</code> in my .go file</p>
  <pre><code>// #cgo CXXFLAGS: -std=c++14 -I.  -flto
  // #cgo LDFLAGS: -lstdc++ -L. -llibforgo
  // #include &quot;Wrapper.h&quot;
  import &quot;C&quot;
  </code></pre>
  <p>but the linker does not seem to find c++  standard calls ans is full of errors like</p>
  <pre><code> undefined reference to `operator new(unsigned long)'
   undefined reference to `operator delete(void*, unsigned long)'
  </code></pre>
  <p>Here are related go environment variables</p>
  <pre><code>CC=&quot;gcc&quot;
  CXX=&quot;g++&quot;
  </code></pre>
  <p>What I am doing wrong? How to tell cgo to use g++ instead of gcc? Maybe I should recompile
  my static <code>c++</code> library with some additional options?</p>