我正在尝试测试 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/amd64D:\Dev\Go\src>go env set GOARCH=amd64 set GOBIN= set GOCHAR=6 set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windowsset 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=1D:\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请检查最后一个错误。怎么了?
1 回答
守着星空守着你
TA贡献1799条经验 获得超8个赞
你从这个程序得到什么输出?
package main
/*
#include <stdlib.h>
*/
import "C"
import (
"fmt"
)
func main() {
fmt.Printf("test %d\n", int(C.rand()))
}
- 1 回答
- 0 关注
- 325 浏览
添加回答
举报
0/150
提交
取消