[英]/../usr/local/go/src/runtime/cgo/cgo.go:34:8: could not import C (cgo preprocessing failed) (typecheck)
Note:笔记:
I am getting the same error `could not import C (cgo preprocessing failed) (typecheck) no matter which version of golangci-lint I use while I am running golangci-lint.我得到同样的错误`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
) to /usr/local/include.
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.
Personally, I found this kinda files in /usr/include
directory, and I copied all files with .h
extension to /usr/local/include.
就个人而言,我在
/usr/include
目录中找到了这种文件,并将所有带有.h
扩展名的文件复制到/usr/local/include.
Plus, I also installed libsnmp-dev
as it is said in the link above.另外,我还安装了
libsnmp-dev
,正如上面链接中所说的那样。
But, I got the same error again...但是,我又遇到了同样的错误......
Any ideas to solve this issue?有什么想法可以解决这个问题吗?
I don't know why but the solution was damn easy for this issue which took my 2 days.我不知道为什么,但这个问题的解决方案非常简单,花了我 2 天的时间。
What I did was to change import "C"
to import ( "C" )
in /usr/local/go/src/runtime/cgo/cgo.go
file, and installing gcc.我所做的是将
/usr/local/go/src/runtime/cgo/cgo.go
文件中的import "C"
更改为import ( "C" )
,并安装 gcc。
That's it, guys:)就是这样,伙计们:)
PS: you are welcome to share your own answers as well because personally I didn't understand my own solution PS:也欢迎您分享您自己的答案,因为我个人不明白我自己的解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.