Function 转到未定义的导入函数
我在使用一个函数时遇到了一个问题,而这个函数应该没有任何问题。 在Go中,以大写字母开头的函数在包外具有可见性Function 转到未定义的导入函数,function,package,go,undefined,Function,Package,Go,Undefined,我在使用一个函数时遇到了一个问题,而这个函数应该没有任何问题。 在Go中,以大写字母开头的函数在包外具有可见性 node.go 加油 梅因,加油 src/grid/Makefile src/main/Makefile 当我编译网格包时,一切都进行得很顺利,但当我尝试编译le main包时,它会给我错误消息: manbear@manbearpig:~/Bureau/go_code/main$ gomake 6g -o _go_.6 main.go main.go:15: undef
node.go 加油 梅因,加油
src/grid/Makefile src/main/Makefile
当我编译网格包时,一切都进行得很顺利,但当我尝试编译le main包时,它会给我错误消息:
manbear@manbearpig:~/Bureau/go_code/main$ gomake
6g -o _go_.6 main.go
main.go:15: undefined: grid.InitGrid
make: *** [_go_.6] Erreur 1
我不明白为什么它会给我这个错误,我已经花了一些时间阅读了Go文档,但是我没有找到它不工作的原因
感谢您的帮助。您仅使用
节点.go
源文件编译并安装了网格
包。使用节点.go
和grid.go
源文件编译并安装grid
包。比如说,
include $(GOROOT)/src/Make.inc
TARG=grid
GOFILES=\
grid.go\
node.go\
include $(GOROOT)/src/Make.pkg
您仅使用
节点.go
源文件编译并安装了网格
包。使用节点.go
和grid.go
源文件编译并安装grid
包。比如说,
include $(GOROOT)/src/Make.inc
TARG=grid
GOFILES=\
grid.go\
node.go\
include $(GOROOT)/src/Make.pkg
我的Makefile的grid.go和node.go顺序颠倒(我做了更改)。我已经完成了“gomake clean”和“gomake”网格包,我尝试编译我的主包,但它给了我相同的结果:“main.go:15:undefined:grid.InitGrid”。对于
grid
包,gomake clean
然后gomake安装
。我的Makefile的顺序是grid.go和node.go(我做了更改)。我已经完成了“gomake clean”和“gomake”网格包,我尝试编译我的主包,但它给了我相同的结果:“main.go:15:undefined:grid.InitGrid”。对于grid
包,gomake clean
然后gomake安装
。
include $(GOROOT)/src/Make.inc
TARG=grid
GOFILES=\
node.go\
grid.go\
include $(GOROOT)/src/Make.pkg
include $(GOROOT)/src/Make.inc
TARG=main
GOFILES=\
main.go\
include $(GOROOT)/src/Make.cmd
manbear@manbearpig:~/Bureau/go_code/main$ gomake
6g -o _go_.6 main.go
main.go:15: undefined: grid.InitGrid
make: *** [_go_.6] Erreur 1
include $(GOROOT)/src/Make.inc
TARG=grid
GOFILES=\
grid.go\
node.go\
include $(GOROOT)/src/Make.pkg