我正在尝试导入并使用 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
有办法解决这个问题吗?
我在 UBUNTU 20.04 上的 C++ 和 ninja 上也遇到类似的问题
cc1plus: error: too many filenames given. Type cc1plus --help for usage
cc1plus: fatal error: ALIGNMENT/CMakeFiles/ALIGNMENT_0.12_svg.dir/home/data/SCC/__public_git/Processing2C/PROJECTS/ALIGNMENT/cppsrc/project_at_once.cpp.d: No such file or directory
compilation terminated.
问题很奇怪。但解决办法很简单!
我需要将我的“-o3”更改为“-O3”CMakeLists.txt(在 UBUNTU 18.04 下运行良好)并且在 UBUNTU 20.04 中也能运行。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)