I am writing a C++ code in tensorflow framework and I want to use a dynamic library written using makefile. In source code I put the path to header file:
#include "tensorflow/cc/include/libtrading/proto/tf_fix_client.h"
to use a function called fix_client(int argc, char **argv) and in the BUILD file I put the path to the dynamic library, called 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 retrieves me an error of:
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