Calling Python from QT C++
ChrisW last edited by ChrisW
I love my C++ and Python. C++ gives me the low-level ability, while Python gives me the high-level. Now, the headache, is trying to integrate both of these languages together. I ran into multiple deadends on YouTube and also seeing a lot of videos that are very, very long. Right now, I just need to integrate the two languages. I saw a package that is supposedly work with QT 4.6.1, however, the headache with that is that it is calling the latest Qt that I have, which is 5.8, I believe. I really don't want to uninstall it.
Another thing, it would be great if I knew how to integrate Python with C++ in Visual Studio 2017.
Thanks ahead for your time, and if you're able to redirect me to an article that is still relevant today, please feel free to point me in that direction without much comment. I know life can be busy. And again, I want to use C++ as my main language and use Python whenever there is a task that Python does better. Also, being able to use the modules of Python is important too.
OMG! So sorry that I'm late to the party. I didn't see this post until now and never got an alert. Thanks and I will make sure to look over this documentation.
tham last edited by
I use boost python to glue c++ and python before, but this solution need the user to install python on their pc.
Another solution is write a server by python and use Qt to communicate with it, this way I can package the python
as a standalone application.
Yes Jsulm, I was able to get Boost working on Visual Studio. Unfortunately, Boost's documentation said that the implementation is limited without the Python API. So I guess they are talking about the Python-Dev package. Unfortunately, I don't really know how to link that package. It is 3 steps that are required for using a third-party library or whatever, but I don't know what to type into the input part of the 3 steps.
Visual Studio is now recognizing the Python.h file, but I get a compiler error:
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'python27_d.lib' Python-Dev c:\Users\chris williams\documents\visual studio 2015\Projects\Python-Dev\Python-Dev\LINK 1
So I decided to type in python27_d.lib as a value for the input.
Just in case if you're not familiar with the 3 steps:
Also, I'm using python-dev-2.7.8-src
if that helps and I cannot find any .lib files.
My understanding is that I need the Python.h file. The examples online on using C++ are straight forward, but they all assume that you have access to that header.