[英]/../usr/local/go/src/runtime/cgo/cgo.go:34:8: could not import C (cgo preprocessing failed) (typecheck)
笔记:
我得到同样的错误`could not import C (cgo preprocessing failed) (typecheck) 无论我在运行 golangci-lint 时使用哪个版本的 golangci-lint。
I have seen this issue on Github: https://github.com/golangci/golangci-lint/issues/1176 where it is told to add header files (like net-snmp/net-snmp-config.h
and net-snmp/mib_api.h
) 到/usr/local/include.
就个人而言,我在/usr/include
目录中找到了这种文件,并将所有带有.h
扩展名的文件复制到/usr/local/include.
另外,我还安装了libsnmp-dev
,正如上面链接中所说的那样。
但是,我又遇到了同样的错误......
有什么想法可以解决这个问题吗?
我不知道为什么,但这个问题的解决方案非常简单,花了我 2 天的时间。
我所做的是将/usr/local/go/src/runtime/cgo/cgo.go
文件中的import "C"
更改为import ( "C" )
,并安装 gcc。
就是这样,伙计们:)
PS:也欢迎您分享您自己的答案,因为我个人不明白我自己的解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.