Embedding python in C++ [closed]
Hi,
I'm trying to embedded a python function in a c++ node. I've read the documentation on docpython for Python 3.4 and I've tried a little example from the doc :
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <python3.4/Python.h>
int main(int argc, char *argv[])
{
ros::init(argc, argv, "fault_detector");
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
Py_Finalize();
return 0;
}
and i get this error :
CMakeFiles/ft_node.dir/src/fault_detector.cpp.o: In function `main':
fault_detector.cpp:(.text+0x63): undefined reference to `Py_Initialize'
fault_detector.cpp:(.text+0x72): undefined reference to `PyRun_SimpleStringFlags'
fault_detector.cpp:(.text+0x77): undefined reference to `Py_Finalize'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/mamy/exo_ws/devel/lib/test/ft_node] Error 1
make[1]: *** [test/CMakeFiles/ft_node.dir/all] Error 2
I've done some research to find my problems but I can't find anything pertinent. It could be a problem of version as I read and i don't know how to change that. If anyone has an answer.
Thank you in advance for your answer