doulian1852 2016-06-11 07:58
浏览 579

无法使用cgo CFLAGS

I have manually cloned the go directory of tensorflow(a library I am working on ) in /home/arafat/go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go you can take a look here. I have made changes to lib.go as

// #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

But I am getting the error

# 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.

on doing

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

I am not able to understand why this is not working.

  • 写回答

1条回答 默认 最新

  • doushenyu8228 2016-09-13 23:12
    关注

    Likely a mistake with the include path, one tensorflow too many? Perhaps you should do

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

    or

    #include "core/public/tensor_c_api.h"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog