cgo踩坑:交叉编译过程出现的问题could not determine kind of name for C.XXX
尝试了网上的几种解决方法,都不行,现总结起来:
- 确认
/*
#include <stdio.h>
*/
import "C"
不要有空行
-
确认你引用的头文件存在(stdio.h这种编译器自带的不需要你确认)
-
如果引用了多个包,必须将c和go的包分开引用:
比如
/*
#include <stdio.h>
*/
import "C"
import ("fmt""strconv""time"
)