Hello,
I want to make a simple application in C (not using C++) which just uses a basic pretrained model for image classification. I want to use the basic C API as described here:
For that, I have built the static library libtensorflowlite_c.a as described here: 使用 CMake 选择性构建 TensorFlow Lite
and put that into the /usr/local/lib folder.
When trying to compile this code:
#include <stdio.h>
#include "tensorflow/lite/c/c_api.h"
int main() {
TfLiteInterpreterOptions* options;
TfLiteModel* model = TfLiteModelCreateFromFile("1.tflite");
options = TfLiteInterpreterOptionsCreate();
TfLiteInterpreterOptionsSetNumThreads(options, 2);
}
I get errors when trying to compile using that command:
gcc -I. -I ../../test_folder/tensorflow_src -I ../../test_folder/tensorflow_src/tensorflow/lite/c -L/usr/local/lib -l:libtensorflowlite_c.a -o ai_test ai_test.c
/usr/bin/ld: /tmp/ccQuyKaS.o: in function `main':
ai_test.c:(.text+0x17): undefined reference to `TfLiteModelCreateFromFile'
/usr/bin/ld: ai_test.c:(.text+0x25): undefined reference to `TfLiteInterpreterOptionsCreate'
/usr/bin/ld: ai_test.c:(.text+0x3a): undefined reference to `TfLiteInterpreterOptionsSetNumThreads'
collect2: error: ld returned 1 exit status
Did I misunderstand something or can somebody help me to resolve this?
Thank you in advance!