My tflite directory is as follows:
/home/me/tensorflow_src/tensorflow/lite/
However, I fail to import it in my C++ project:
#include "tensorflow/lite/interpreter.h" // getting a not found error
How can I add resolve this error? My assumption is that I’d need to add the tflite to my bash to make it available for all of my projects. How can I add tflite to the bash file?
This is my CMAKE file:
cmake_minimum_required(VERSION 3.22)
project(mediafile_device_crossverification)
set(CMAKE_CXX_STANDARD 17)
set(OpenCV FOUND 1)
find_package(OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(mediafile_device_crossverification main.cpp src/VideoProcessing.cpp src/VideoProcessing.h)
2
Answers
There are various options:
First option: Install/copy the tensorflow header files to e.g.
/urs/local/include
that folder is usually in the system include path by default.Second option: GCC has some environment variables that can be used to modify the system include path.
C_INCLUDE_PATH
andCPLUS_INCLUDE_PATH
, your can add them to.bashrc
to set them when you login. See: https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.htmlThird option is to add
/home/me/tensorflow_src
to the include path in the CMakefile.When searching the include path
#include <tensorflow/lite/interpreter.h>
should be used.You can’t really make it available for the entire system with the way TFLite’s CMake is currently configured.
There’s a section in TFLite’s documentation which shows you how to build a project depending on it.
A bit further up there’s also a note why the library cannot be built stand-alone for time time being: