Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I link to when embedding Python in C++

What do I need to link to, so that I can use Py_Initilize and Py_SimpleString and stuff in C++?

I am using vs 2012 on windows 7 64 bit. I am compiling to win32(I think) and I have the 32bit python33. I did look through the Python Documentation, but there wasn't anything that I could find about compiling and linking for windows, just for linux.

So how do I link to python?

Do I need to use an external library to embed Python in my C++ application?

I am planning to use a c++ app to be the launcher, to start the python script which calls a different class/module. I am still learning Python, but I know some C++.

like image 624
nicedude80 Avatar asked May 05 '26 04:05

nicedude80


1 Answers

You need to link with python33.lib in your python install dir. Also you need to add the python install dir/include directory to your path of libs for the #include <Python.h> to work.

You need tor read this first, also I think you should download the python code and try with the examples there (under PC dir).

like image 195
Alvaro Fuentes Avatar answered May 06 '26 21:05

Alvaro Fuentes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!