Arduino multiple definition

Hello,

I’m rewriting the Arduino example for my project. I want to use this example in a custom class instead of the main file. I include using #include <xxxxxx_inference.h> in my header file.
The problem is that I’m getting a lot of multiple definition error messages like the ones here, starting with ei::spectral::processing::spectral_power_edges.

Full error:

c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing ::spectral_power_edges(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/filters.hpp:121: multiple definition of ei::spectral::processing::spectral_power_edges(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:608: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::spectral_power_edges(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float)': c:\users\jurg\documents\arduino\libraries\ei-drilling-arduino-1.0.1\src\edge-impulse-sdk\dsp/numpy.hpp:895: multiple definition of ei::spectral::processing::spectral_power_edges(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:661: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::periodogram(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float, unsigned short)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:247: multiple definition of ei::spectral::processing::periodogram(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float, unsigned short)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:728: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::periodogram(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float, unsigned short)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/feature.hpp:172: multiple definition of ei::spectral::processing::periodogram(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float, unsigned short)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:820: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_init(ei_classifier_smooth*, unsigned int, unsigned char, float, float)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:53: multiple definition of ei_classifier_smooth_init(ei_classifier_smooth*, unsigned int, unsigned char, float, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:53: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_update(ei_classifier_smooth*, ei_impulse_result_t*)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:71: multiple definition of ei_classifier_smooth_update(ei_classifier_smooth*, ei_impulse_result_t*)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:71: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_free(ei_classifier_smooth*)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:141: multiple definition of ei_classifier_smooth_free(ei_classifier_smooth*)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:141: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_moving_average_filter': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:135: multiple definition of run_moving_average_filter’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:135: first defined here
c:\Users\jurg
\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_init': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:169: multiple definition of run_classifier_init’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:169: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_inference': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:624: multiple definition of run_inference’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:624: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_continuous': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:190: multiple definition of run_classifier_continuous’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:190: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_inference_i16': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:888: multiple definition of run_inference_i16’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:888: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_image_quantized': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1228: multiple definition of run_classifier_image_quantized’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1228: first defined
here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1001: multiple definition of run_classifier’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1001: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:39: multiple definition of ei_dsp_blocks_i16' c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:39: first defined here c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:30: multiple definition of ei_dsp_blocks’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino
\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:30: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:180: multiple definition of ei_dsp_config_33' c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:180: first defined here c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:92: multiple definition of ei_classifier_inferencing_categories’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:92: first defined here
collect2.exe: error: ld returned 1 exit status
Error during build: exit status 1
IntelliSense configuration already up to date. To manually rebuild your IntelliSense configuration run “Ctrl+Alt+I”
[Error] Analyzing sketch ‘EdgeImpulse_inference2.ino’: Exit with code=1

[Starting] Verifying sketch ‘EdgeImpulse_inference2.ino’
Please see the build logs in output path: c:\Users\jurg\Documents\sensor\build
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::spectral_power_edges(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, ei ::ei_matrix*, float)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/filters.hpp:121: multiple definition of ei::spectral::processing::spectral_power_edges(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:608: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::spectral_power_edges(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float)': c:\users\jurg\documents\arduino\libraries\ei-drilling-arduino-1.0.1\src\edge-impulse-sdk\dsp/numpy.hpp:895: multiple definition of ei::spectral::processing::spectral_power_edges(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:661: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::periodogram(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float, unsigned short)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:247: multiple definition of ei::spectral::processing::periodogram(ei::ei_matrix*, ei::ei_matrix*, ei::ei_matrix*, float, unsigned short)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:728: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei::spectral::processing::periodogram(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float, unsigned short)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/feature.hpp:172: multiple definition of ei::spectral::processing::periodogram(ei::ei_matrix_i16*, ei::ei_matrix_i16*, ei::ei_matrix_i16*, float, unsigned short)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/dsp/spectral/processing.hpp:820: first defined here
c:\Users
\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_init(ei_classifier_smooth*, unsigned int, unsigned char, float, float)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:53: multiple definition of ei_classifier_smooth_init(ei_classifier_smooth*, unsigned int, unsigned char, float, float)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:53: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_update(ei_classifier_smooth*, ei_impulse_result_t*)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:71: multiple definition of ei_classifier_smooth_update
(ei_classifier_smooth*, ei_impulse_result_t*)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:71: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function ei_classifier_smooth_free(ei_classifier_smooth*)': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:141: multiple definition of ei_classifier_smooth_free(ei_classifier_smooth*)’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_classifier_smooth.h:141: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_moving_average_filter': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:135: multiple definition of run_moving_average_filter’
c:\Users\jurg\Documents\sensor\build\sketch
\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:135: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_init': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:169: multiple definition of run_classifier_init’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:169: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_inference': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge -impulse-sdk/classifier/ei_run_classifier.h:624: multiple definition of run_inference’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:624: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a
(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_continuous': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:190: multiple definition of run_classifier_continuous’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:190: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_inference_i16': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:888: multiple definition of run_inference_i16’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents
\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:888: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function run_classifier_image_quantized': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1228: multiple definition of run_classifier_image_quantized’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1228: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o): In function
run_classifier': C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1001: multiple definition of run_classifier’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/edge-impulse-sdk/classifier/ei_run_classifier.h:1001: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:39: multiple definition
of ei_dsp_blocks_i16' c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:39: first defined here c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:30: multiple definition of ei_dsp_blocks’
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/dsp_blocks.h:30: first defined here
c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:180: multiple definition of ei_dsp_config_33' c:\Users\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:180: first defined here c:\Users\jurg\Documents\sensor\build\sketch\objs.a(EdgeImpulse_inference2.ino.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:92: multiple definition of ei_classifier_inferencing_categories’
c:\Users
\jurg\Documents\sensor\build\sketch\objs.a(Edge.cpp.o):C:\Users\jurg\Documents\Arduino\libraries\ei-drilling-arduino-1.0.1\src/model-parameters/model_metadata.h:92: first defined here
collect2.exe: error: ld returned 1 exit status

Can someone help me to get this working?

Jurg

Hey, I’m the one who you mention in that post. I might be able to help you. Do you think you can provide a minimum reproducible code?

#include "Edge.h"

Edge::Edge()
{
}

ei_impulse_result_t Edge::ai()
{
    ei_impulse_result_t result = {0};
    unsigned short featureAmount = FeatureCollector::getInstance().getFeatureCounter();

    float* features = FeatureCollector::getInstance().getFeatures();

    signal_t features_signal;
    features_signal.total_length = sizeof(features) / sizeof(features[0]);
    features_signal.get_data = &raw_feature_get_data;

    EI_IMPULSE_ERROR res = run_classifier(&features_signal, &result, false /* debug */);
    return result;
}

int raw_feature_get_data(size_t offset, size_t length, float *out_ptr)
    {
    memcpy(out_ptr, FeatureCollector::getInstance().getFeatures() + offset, length * sizeof(float));  
    return 0;
 }

Edge.cpp

#ifndef MY_EDGE_H

#define MY_EDGE_H

#include <drilling_inference.h>

#include "FeatureCollector.h"

class Edge

{

public:
  Edge();
  ei_impulse_result_t ai();

};

int raw_feature_get_data(size_t offset, size_t length, float *out_ptr);

#endif

edge.h

I just placed the example code into a class.

@Jurg do you also have #include <drilling_inference.h> in your sketch? Can you remove it there?

Or move the #include to the cpp file.

No, the Edge.h-file is the only file with #include <drilling_inference.h> in it. I moved the #include to the Edge.cpp-file and it gives me the same error messages.

Can you try having just the .h file? Edge Impulse SDK ships as a header-only code so it is a bit tricky in terms of what to #include and where

// EDGE.h
#ifndef MY_EDGE_H
#define MY_EDGE_H

#include <drilling_inference.h>
#include "FeatureCollector.h"

class Edge
{

public:
  Edge()
  {
  }

  ei_impulse_result_t ai()
  {
    ei_impulse_result_t result = {0};
    unsigned short featureAmount = FeatureCollector::getInstance().getFeatureCounter();

    float* features = FeatureCollector::getInstance().getFeatures();

    signal_t features_signal;
    features_signal.total_length = sizeof(features) / sizeof(features[0]);
    features_signal.get_data = &raw_feature_get_data;

    EI_IMPULSE_ERROR res = run_classifier(&features_signal, &result, false /* debug */);
    return result;
  }

};

int raw_feature_get_data(size_t offset, size_t length, float *out_ptr)
    {
    memcpy(out_ptr, FeatureCollector::getInstance().getFeatures() + offset, length * sizeof(float));  
    return 0;
 }

#endif

I fixed the problem. I added the #include to the Edge.cpp-file. After that I updated the Arduino-CLI to a slightly newer one and after that it started working.