Hello,
I am new to C programming and tried using the Simple Open EtherCAT library (SOEM) on a raspberry Pi. The language used is C.
I pulled the github repository from here (GitHub - OpenEtherCATsociety/SOEM: Simple Open Source EtherCAT Master) on my raspberry Pi. Then I built it as described in the README.md. The file path on my raspberry is now: /home/raspberrypi/SOEM.
I then connected an EtherCAT slave (to be precise, I connected 3: EK1100, EL1809 and EL2809) and then have run the simple_test executable (can be found in: /home/raspberrypi/SOEM/build/test/linux/simple_test) which worked fine. The output I got was without errors and the slave devices were detected.
Then I tried to programm my first own script which should make use of the SOEM functionalities (such as reading out the slaves PDO data). In the folder SOEM there is a simple_test.c file, which can be modified. When compiled, this file should do the exact same thing as the executable simple_test (which was described previously).
However, when I tried compiling the simple_test.c file using
gcc simple_test.c -o simple_test
in the terminal window, it throws an error saying:
fatal error: osal.h: No such file or directory
#include "osal.h"
The error should come from the fact that the program to be compiled does not know where the associated .h files are located. These are mostly under home/raspberrypi/SOEM/soem (however there are other files such as .o files in a different location).
My question is: How do I just manage to tell the program where the linked files are located? Do I have to specify the full file path every time I use the #include "..." command? If I do that, the compilation still throws errors because the needed functions are not found.
Thank you in advance!
Best regards,
Tobias