c++ python 3 binding

c++, python

Solution

Try following:

wchar_t progname[FILENAME_MAX + 1];
mbstowcs(progname, argv[0], strlen(argv[0]) + 1);
Py_SetProgramName(progname);

http://www.cplusplus.com/reference/cstdlib/mbstowcs/

Problem

I am trying to bind python3 in C++. When using this: ``` Py_SetProgramName(argv[0]); ``` it gives this error: ``` error C2664: 'Py_SetProgramName' : cannot convert parameter 1 from 'char *' to 'wchar_t *' ``` Even though that's how the documentation example shows to do it. I also tried this: ``` Py_SetProgramName((wchar_t*)argv[0]); ``` But apparently that's the wrong way to do it. So how do I fix this, and is there any other good resources on binding Python 3 in C++?

Original source

Related problems