Import C error in Golang: cc1.exe: error: too many filenames given
Import C error in Golang: cc1.exe: error: too many filenames given
我正在尝试导入和使用 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
有办法解决这个问题吗?
一个 was caused by a space in the mingw安装路径,例如"c:\Program Files..."。这种情况下的解决方案是重新安装到没有空格的路径。
我在 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.
这个问题很奇怪。但解决方案很简单!
我需要在我的 CMakeLists.txt 中将“-o3”更改为“-O3”(在 UBUNTU 18.04 下运行良好)并且它在 [=18 中运行=] 20.04.
我正在尝试导入和使用 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.
这个问题很奇怪。但解决方案很简单! 我需要在我的 CMakeLists.txt 中将“-o3”更改为“-O3”(在 UBUNTU 18.04 下运行良好)并且它在 [=18 中运行=] 20.04.