I have a trivial program to test for availability of python development files:
#include int main(){Py_Initialize(); Py_Finalize(); } <
#include int main(){Py_Initialize(); Py_Finalize(); }
I encountered the same linking problem as well. But in my case it was not enough to provide -lpython. Also -L was needed. I.e.
-lpython
-L
g++ -I/usr/include/python3.5 hw.cpp -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5
And yes. Order matters.