this is bug 10715: https://github.com/golang/go/issues/10715
a more idiomatic solution is available here: https://github.com/golang/go/blob/master/misc/cgo/stdio/stdio.go On Sun, Jul 31, 2016 at 1:22 AM, P Q <application...@gmail.com> wrote: > https://play.golang.org/p/4XZSmyRkZa > > I've got error message when building the code as follows: > > C:\Users\Home\AppData\Local\Temp\go-build437760086\command-line-arguments\_obj\_cgo_main.o:_cgo_main.c:(.data+0x0): > undefined reference to `stdout' > collect2.exe: error: ld returned 1 exit status > > I don't know what's something wrong as I'm using no external library, and > using just standard library. I suspect what cause the error is associated > with linker, but I'm not sure. How can it be fixed to be compiled? > > I know workaround that make wrapping function in C side and use the function > in Go side like this: https://play.golang.org/p/NncAFmlPXN. I do expect true > solution to this problem, not workaround. > > Note: version of go on this computer is go1.6.2 windows/amd64. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.