You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns compiler error: "could not determine kind of name for C.free"
What version of Go are you using (go version)?
$ go version
go version go1.14.3 windows/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\yusuf\AppData\Local\go-build
set GOENV=C:\Users\yusuf\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\yusuf\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\yusuf\AppData\Local\Temp\go-build313812094=/tmp/go-build -gno-record-gcc-switches
PS C:\Users\yusuf\Desktop\cfree-compiler-error>
I have copied this code from https://golang.org/cmd/cgo/
`package main
import "C"
import "unsafe"
func main() {
cs := C.CString("Hello from stdio")
C.myprint(cs)
C.free(unsafe.Pointer(cs))
}`
And here is my code
`package main
import "C"
import "unsafe"
import "fmt"
func main() {
s := "Hello World!"
cs := C.CString(s)
C.free(unsafe.Pointer(cs))
fmt.Println(s)
}`
Returns compiler error: "could not determine kind of name for C.free"
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
`package main
import "C"
import "unsafe"
import "fmt"
func main() {
s := "Hello World!"
cs := C.CString(s)
C.free(unsafe.Pointer(cs))
fmt.Println(s)
}`
What did you expect to see?
"Hello World!"
What did you see instead?
compiler error: "could not determine kind of name for C.free"
The text was updated successfully, but these errors were encountered: