Re: [go-nuts] Building executable for code with cgo produces link errors

2021-01-21 Thread Ian Lance Taylor
On Thu, Jan 21, 2021 at 10:21 PM Nicholas Yue wrote: > > /* > #include "hello.c" > */ > import "C" Doing a #include of "hello.c" is unusual. That is most likely your problem. The comment before the import "C" is handled as C code. C code rarely does a #include of a .c file. Normally one does

[go-nuts] Building executable for code with cgo produces link errors

2021-01-21 Thread Nicholas Yue
Hi, I am using Go 1.15 on Ubuntu 18.04 I am learning about cgo via the following tutorial https://golang.org/cmd/cgo/ I have the following two files which I am able to run via go run cgo_main.go Knowing that it runs, I'd like to build it into an executable but I get the fol