I am getting linking error in Visual Studio That unresolved external symbol __ipm_Py_Finalize referenced in function _main, etc like that.
I Have Added the Library folder of python in the linker additional library dir and added include folder in C/C++ Additional Include Directory, I don’t know what I am doing wrong but here’s My main.c:
#include <stdio.h>
#include <stdbool.h>
#include <Python.h>
int main() {
Py_Initialze();
printf("Initialized python interpreter!");
PyObject* module = PyImport_ImportModule("CPBridger");
if (module == NULL) {
printf("Can't find module!");
return -1;
}
PyObject* func = PyObject_GetAttrString(module, "helloWorld");
PyObject* args = PyTuple_Pack(0);
PyObject_CallObject(func, args);
Py_XDECREF(func);
Py_XDECREF(args);
func = PyObject_GetAttrString(module, "sayHelloTo");
args = PyTuple_Pack(1, PyString_FromString("LakshyaK2011"));
PyObject_CallObject(func, args);
Py_XDECREF(func);
Py_XDECREF(args);
Py_XDECREF(module);
Py_Finalize();
printf("Finalized python interpreter!");
}
Could this be some IDE Error or I am doing wrong.
Thanks.
Addition to this:
I am only getting errors on Linking step OF My VS IDE, and Compiling is happening successfully without any errors.