我正在尝试测试 cgo 代码。
package main
// #include <stdlib.h>
import (
"C"
"fmt"
)
func main() {
fmt.Printf("test %d\n", int(C.random()))
}
D:\Dev\Go\src>go version
go version go1.3 windows/amd64
D:\Dev\Go\src>go env
set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\\Dev\\Go
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64-mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
D:\Dev\Go\src>go run test_binding.go
# runtime/cgo C:\Users\hyoon\AppData\Local\Temp\go-build779392087\runtime\cgo\_obj\_cgo_defun.c:7 6c: No such file or directory: runtime.h
请检查最后一个错误。怎么了?
守着星空守着你
相关分类