Error in building the app with the exported cpp package

Question/Issue: I have followed the guide at On your desktop computer | Edge Impulse Documentation and tried to run the continuous motion recognition example.
On windows, I am getting following error:
edge-impulse-sdk/porting/mingw32/ei_classifier_porting.cpp: In function ‘EI_IMPULSE_ERROR ei_sleep(int32_t)’:
edge-impulse-sdk/porting/mingw32/ei_classifier_porting.cpp:38:26: error: ‘usleep’ was not declared in this scope
usleep(time_ms * 1000);

Also tried to build this on linux but getting this error:
collect2: error: ld returned 1 exit status
make: *** [Makefile:112: app] Error 1

Please help me to solve this issue.

Project ID: 384206

Context/Use case: continuous motion recognition

Hi @ashokp

Windows

  • MinGW-W64 which includes both GNU Make and a compiler. Make sure mingw32-make is in your PATH.

Did you configure MinGW?

usleep is linux but should be available when MinGW is configured.

Best

Eoin

@mateusz fyi

Also did you start with the base project I see continuous motion recognition, so I assume you followed this:

Best

Eoin

Thanks @Eoin,
The error of usleep undefined is gone, the issue was I had installed some other mingw. but now there is a new error:
g++ ./build/AR1.a ./build/AR2.a ./build/AR3.a -o ./build/app -lm -lstdc++
D:/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.1.0/…/…/…/…/x86_64-w64-mingw32/lib/…/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain’
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:113: app] Error 1
“Building standalone classifier OK”

Yes, I started with the tutorial project “continuous motion recognition” and followed the link you shared.

To install the mingw64, I downloaded the binary from the link and added the path to the environment variables. For command gcc --variables, it returns
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is the mingw installed correctly or there is anything else to do?

  • collect2: error: ld returned 1 exit status usually indicates a linker error. This could be due to missing libraries or incorrect configurations.
  • Make sure that all required libraries are correctly linked in your project configuration.

I’d guess something was missed on the project / SDK setup if you go back over and start fresh you should have the minGW in place now, double check that all of the environment variables were set correctly and follow through:

Best

Eoin