Ask coding questions

← Back to all posts
How to convert Python to C++?
RixTheTyrunt

Hello, I need to convert a Python file ( Well, I will download Sprint's Pythonish file ) to a C++ one. How to do that? Also,
please,
HALP ME

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
RixTheTyrunt
Comments
hotnewtop
SixBeeps

That's kinda like asking "how can I make a dog out of a set of human bones?". Sure you might be able to do it, but it'd be a whole lot easier if you had a set of dog bones (i.e. just re-writing your program in C++).

What is your end goal?

RixTheTyrunt

OK, I will rewrite to C++.

Speech in C++


What about speaking?! Workaround this:

SixBeeps

@RixTheTyrunt You'll have to learn how the system handles sound, likely stuff having to deal with audio streams or maybe even interpreting the hardware data.

Look for other libraries that might handle that for you.

Answer my question though, why do you want to do this? You might be able to avoid all of that if converting to C++ isn't your best option.

RixTheTyrunt

Well, I want to convert my Python code into an executable ( .EXE )

SixBeeps

@RixTheTyrunt Then you do not need C++. Look into using PyInstaller instead.

RixTheTyrunt

I didn't install Python

RixTheTyrunt

At all.

RixTheTyrunt

Maybe Replit has a PyInstaller's package?

SixBeeps

@RixTheTyrunt You should be able to run PyInstaller as you would on a local machine. Are you having issues with it?

IMayBeMe

If you really want you could cross-compile python to C++ but you would need to be pretty good when it comes to compiler design for that.

RixTheTyrunt

Yeah, maybe it would be