我正在 tensorflow 框架中编写 C++ 代码,我想使用使用 makefile 编写的动态库。在源代码中,我放置了头文件的路径:
#include "tensorflow/cc/include/libtrading/proto/tf_fix_client.h"
使用一个名为 fix_client(int argc, char **argv) 的函数并在 BUILD 文件中放置动态库的路径,名为 libtrading.so:
cc_binary(
name = "session",
srcs = ["work/session.cc"],
copts = tf_copts(),
linkopts = [
"-lpthread",
"-lm",
#for libtrading
"-L/home/alessandro_mercadante/tensor_flows/tensorflow/tensorflow/cc/include/",
"-ltrading",
],
...
bazel-build 检索到以下错误:
bazel-out/local_linux-opt/bin/tensorflow/cc/_objs/session/tensorflow/cc/work/session.o: In function `main':
session.cc:(.text.startup.main+0x2b): undefined reference to `fix_client(int, char**)'
collect2: error: ld returned 1 exit status