ArduCAM / Arducam_tof_camera

46 stars 18 forks source link

undefined reference to 'arducamCameraClose' #67

Open GasparQ opened 4 months ago

GasparQ commented 4 months ago

Hello, I ran into an error inside the (test.c)[https://github.com/ArduCAM/Arducam_tof_camera/blob/main/example/c/test.c] example into the repository.

First of all, the example compile without any error as is so there is no problem about it.

However, the code is still invalid and compile only because the compiler ignore the code after the for (;;) loop.

This is because modern compilers optimise the compilation by ignoring unused code and the for (;;) instruction indicates clearly an infinite loop which is impossible to quit.

So this mean that the following lines are ignored:

if (arducamCameraStop(tof))
    exit(-1);
if (arducamCameraClose(tof))
    exit(-1);
return 0;

In my application, the code imply a compilation of the following lines but the compiler returns the following error at linking time undefined reference to 'arducamCameraClose'.

However the function is defined into ArducamDepthCamera.h header.

So I suggest you remove this function from ArducamDepthCamera.h (because it is deprecated) or you add the symbol to ArducamDepthLib2c.so shared library.

To easily reproduce this, just remove the entire for loop and this should not compile.

dennis-ard commented 4 months ago

Hello, can you provide the installed version of TOF SDK?you can use the following command to query:

dpkg -l | grep arducam-tof-sdk-dev
ii  arducam-tof-sdk-dev                    0.1.2                           armhf        Driver development kit for arducam tof camera...