无法使用cgo CFLAGS

时间:2016-06-11 07:58:26

标签: go cflags

我已经在/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

我无法理解为什么这不起作用。

1 个答案:

答案 0 :(得分:0)

包含路径可能是一个错误,一个张量流量太多了?也许你应该做

view

override func viewDidLoad() {
    super.viewDidLoad()

    let tableView = UITableView(frame: view.frame, style: .Plain)

    tableView.translatesAutoresizingMaskIntoConstraints = false;
    tableView.backgroundColor = UIColor.blueColor() // For visualisation
    self.view.addSubview(tableView)

    tableView.topAnchor.constraintEqualToAnchor(topLayoutGuide.bottomAnchor).active = true
    tableView.rightAnchor.constraintEqualToAnchor(view.rightAnchor).active = true
    tableView.bottomAnchor.constraintEqualToAnchor(view.bottomAnchor).active = true
    tableView.leftAnchor.constraintEqualToAnchor(view.leftAnchor).active = true
}