I would like call python functions from C++. I am using Ubuntu 20.04 and have python 3.8 installed. The path where Python.h
is located is /usr/include/python3.8/Python.h
, which I found using the command line sudo find / -iname python.h
in the terminal. In order to get started I tried to run the easiest code in code::blocks:
#include <Python.h>
#include <iostream>
using namespace std;
int main()
{
cout<<"starting interpreter."<<endl;
Py_Initialize();
PyRun_SimpleString("Hallo from Python");
Py_Finalize();
return 0;
}
I get the error message:
fatal error: Python.h: No such file or directory|
My question is: Which libraries do I have to include and how do I include these in code::blocks? For a detailed description I would be very thankful.
Greetings, Ben