Hello I am trying to use TensorFlow for C/C++. Currently I am trying to get the basic program they offer in their installation instructions to compile.
https://www.tensorflow.org/install/install_c
I am working on x86_64 machine running Ubuntu. I believe I installed the library properly. When I list the directories in the /usr/local/ folder, I see tensorflow in there.
$: ls /usr/local/include/
tensorflow
However, when I attempt the compile the basic program they offer, it fails with both gcc and g++
$: gcc -o test hello_tf.cpp
/tmp/cczK3WZs.o: In function `main':
hello_tf.cpp:(.text+0x5): undefined reference to `TF_Version'
collect2: error: ld returned 1 exit status
$: g++ -o test hello_tf.cpp
/tmp/ccl7FitR.o: In function `main':
hello_tf.cpp:(.text+0x5): undefined reference to `TF_Version'
collect2: error: ld returned 1 exit status
Everything went smoothly on install except when I ran ldconfig as suggested for installing into a system directory.
$ sudo ldconfig /sbin/ldconfig.real:
/usr/lib/libusbredirparser.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libid3tag.so.0 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libusbg.so.0 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libusbmuxd.so.2 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libmtp.so.9 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libmad.so.0 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libusb-1.0.so.0 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libusbredirhost.so.1 is not a symbolic link
Nevertheless, these files do not seem like they should affect the compilation of the program in question. When I run the troubleshooting compilation command, it seems to work. I am not sure why this is
g++ -I/usr/local/include -L/usr/local/lib hello_tf.cpp -ltensorflow