I am facing a linking error for Py_initialize though I have a reference to my Python library in my CMake. The Python.h is found but the link is not established.
inpainting.cpp:(.text+0x47843): undefined reference to `Py_Initialize'
/usr/bin/ld: inpainting.cpp:(.text+0x47854): undefined reference to
`PyRun_SimpleStringFlags'
/usr/bin/ld: inpainting.cpp:(.text+0x47940): undefined reference to `Py_Finalize'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/imgCodecs.dir/build.make:552: imgCodecs] Error 1
make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/imgCodecs.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Here is my CMakeList. https://pastebin.com/QkihgBGm
Edit: Adding how I am trying to compile. I do Cmake and a make on my makefile.
Here is the C++ code that I am trying to compile.
// *********** Begin: Run Python script ************************************************************
// Initialize the Python Interpreter
Py_Initialize();
PyRun_SimpleString("import sys");
char buff[FILENAME_MAX]; //create string buffer to hold path
getcwd( buff, FILENAME_MAX);
string current_working_dir(buff);
string shore_working_dir = current_working_dir +
"/shore_imputation/";
const char * shore_working_dir_c = shore_working_dir.c_str();
qDebug() << shore_working_dir_c;
// Finish the Python Interpreter
Py_Finalize();
// *********** End: Run Python script
**************************************************************