title: CGo not compiling C files in same directory
body: <p>I am trying to create a CGO program with separate C source file in the same directory. As mentioned in the official Cgo docs, Cgo will compile all C files in the same directory but in this case, it is not compiling the C file. And later gives a linker error.</p>
  
  <p>myTest.go </p>
  
  <pre><code>package main
  
  /*
  
  #include &lt;stdlib.h&gt;
  #include "myTest.h"
  
  */
  import "C"
  import "unsafe"
  
  func Print(s string) {
      cs := C.CString(s)
      C.print_str(cs)
      C.free(unsafe.Pointer(cs))
  }
  
  func main() {
      str1 := "hi how are you\n"
      Print(str1)
  }
  </code></pre>
  
  <p>myTest.h</p>
  
  <pre><code>void print_str(char *s);
  </code></pre>
  
  <p>myTest.c</p>
  
  <pre><code>#include "stdio.h"
  
  void print_str(char *s)
  {
      printf("%s\n", s?s:"nil");
  }
  </code></pre>
  
  <p>While compiling, I am getting the following error:</p>
  
  <pre><code>&gt; go build myTest.go
  
  # command-line-arguments
  /tmp/go-build989557946/b001/_x002.o: In function `_cgo_4c80c9e4eaf0_Cfunc_print_str':
  /tmp/go-build/cgo-gcc-prolog:49: undefined reference to `print_str'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Go version is:</p>
  
  <pre><code>&gt; go version
  go version go1.10 linux/amd64
  </code></pre>