Running EI C++ Library on Flutter

Running EI C++ Library on Flutter

I have a simple Flutter FFI example app executing functions in a CPP file.

Then I add the EI stuff to see if Flutter will compile in the EI C++ code:

In the CPP file I add:

#include "edge-impulse-sdk\classifier\ei_run_classifier.h"

In the CMakeList.txt file I add:


The include folder is the EI C++ code that looks like:

# |--include
# |-- edge-impulse-sdk
# |-- model-parameters
# |-- tflite-model
# CMakeLists.txt
# README.txt

The error I get is:

error: no member named 'post_process_boxes' in namespace 'tflite'

Of course does indeed define

namespace tflite {
float post_process_boxes[100 * 4 * sizeof(float)];

So the compiler is finding the EI C++ code but can’t compile it.

Is there something I can add to CMakeLists.txt to get this to compile?

Hi @MMarcial,

I’m not familiar with Flutter FFI, so I won’t be able to help much there.

For CMake, I highly recommend checking out this example project:

From what I can tell, utils.cmake only includes a limited subset of sources/headers that come with the C++ SDK library. You should include the top level directory of the SDK (e.g. my-project-v01). When you unzip the SDK, there should be a CMakeLists.txt in that top level directory that you need to include so that CMake can find everything in the SDK.

Hope that helps!

Thanks for the link. The link provided me with some new ideas.

Now after 10 days with 41 try-fails per-day I say uncle

For anyone interested in solving this issue the Flutter project code for Android Studio is here.

If nothing else the code shows how to call a function in a C++ file from a DART file.