我正在尝试导入和使用 C 包,但我不断收到此错误:
# runtime/cgo
cc1.exe: error: too many filenames given. Type cc1.exe --help for usage
cc1.exe: fatal error: Files/Win-builds/include: No such file or directory
compilation terminated.
exit status 2
Process exiting with code: 1
这是代码:
package main
import (
"C"
"fmt"
"unsafe"
)
func main() {
c := 1
var Cvar C.int = 1
cup := unsafe.Pointer(&c)
cbyte := C.GoBytes(cup, Cvar)
fmt.Printf("%x", cbyte)
}
我在互联网上到处搜索,但找不到任何解决方案。
在 Windows 64 位上:
> gcc --version
gcc (GCC) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> go version
go version go1.14 windows/amd64
有没有办法解决这个问题?