gpt4 book ai didi

go - 无法使用 cgo CFLAGS

转载 作者:IT王子 更新时间:2023-10-29 01:15:28 26 4
gpt4 key购买 nike

我已经在 /home/arafat/go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go 中手动克隆了 tensorflow(我正在研究的库)的 go 目录你可以看看here .我已经对 lib.go 进行了更改作为

// #cgo LDFLAGS: -ltensorflow
// #cgo CFLAGS: -I /home/arafat/go/src/github.com/tensorflow/tensorflow
// #cgo CXXFLAGS: -I /home/arafat/go/src/github.com/tensorflow/tensorflow -std=c++11

但是我得到了错误

# github.com/tensorflow/tensorflow/tensorflow/contrib/go
In file included from go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go/tf_session_helper.cc:20:0:
go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go/tf_session_helper.h:22:49: fatal error: tensorflow/core/public/tensor_c_api.h: No such file or directory
#include "tensorflow/core/public/tensor_c_api.h"
^
compilation terminated.

在做

go get github.com/tensorflow/tensorflow/tensorflow/contrib/go

我不明白为什么这不起作用。

最佳答案

包含路径可能有错误,一个tensorflow太多了?也许你应该做

// #cgo CFLAGS: -I /home/arafat/go/src/github.com/tensorflow

#include "core/public/tensor_c_api.h"

关于go - 无法使用 cgo CFLAGS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37761362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com