I am trying to control Dynamixel servos using a GUI made using Qt. Dynamixel provides a C set of C libraries to control the motors, while the only way of making GUI\'s I kno
Yes. To use C library function use extern "C" as below in your .cpp program , myprog.cpp
extern "C" {
// C Function call
cfunc();
}
int main()
{
cfunc();
return 0;
}
This cfunc should be defined in c library as below prog.c
#include
void cfunc()
{
printf("This is from c library");
}
Then you need to create .o object file and .so shared object files for your C library as below
$] gcc -c prog.c -o prog
$] gcc -shared -o libprog.so prog.o
$] export LD_LIBRARY_PATH=/path/to/clibrary:$LD_LIBRARY_PATH
$] g++ -L/path/to/clibrary myprog.cpp -o myprog.o -lprog