R
R
Rafirto2021-07-01 17:33:12
C++ / C#
Rafirto, 2021-07-01 17:33:12

How to translate a c++ program into exe and that would run the axis on any Windows computer?

It is necessary to translate a program written in C ++ into exe. That is, so that any computer with the Windows operating system can run it. I did not find any information on the Internet

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rPman, 2021-07-01
@rPman

The question is actually very difficult.
In addition to being able to write programs, a developer must be able to customize their working environment.
Often, if you use some kind of development environment (IDE, for example Microsoft Visual Studio), then it will be responsible for assembling the exe file and the entire project, and the user is given the opportunity to configure everything necessary in the mouse interface.
For example, when creating a "C++ Console Application" project (the name is approximate, I don't remember exactly), the project will be automatically configured to build a console application, no extra libraries are connected, etc. Moreover, you may need to build an application for several architectures at once (x86 and x86_64 for example), i.e. by a set of exe / dll for each architecture, and there are cases when even database files are not portable and will require their own for each.
After building all the necessary exe and dll (there is), you need an installer program created from your application, which will collect all the necessary files, exe, dll and start settings ... usually this program is a single archive file in a special format.
In the simplest cases, when you don’t even need to create a shortcut on the target machine (just unpack and that’s it), you can use some kind of self extracted archive (winrar has such an option). Sometimes the tools for creating such a package are in the IDE itself (I definitely remember that visual studio had this for managed .net code), and sometimes it’s a third-party application, for windows I recommend trying inno setup , it allows you to create not only an exe installer but also msi (a specialized format windows for installation archives), this application allows you to describe the installation process in the form of some language, without bothering with the interface.
ps windows there is no direct restriction on running applications without installation, i.e. just manually copy the exe file and that's it
upd. for C++, one more challenge is added, to decide which compiler to build, which standards (standard implementation of the try / catch / throw exception, the format of the names of the plug-in dlls, etc.), which core libraries (for example, which one will be used by libc) and even for which version of the OS you are building (for example, having built under the latest win10, the application may not start on win7 or winxp, because it will require an incompatible version of visual studio redistributable (vcredist * .exe, this update package is carried around by everyone who is not too lazy, and by the way, licensed to do this is without the permission of Microsoft)
It so happened historically that it is normal to find a toolchain under windows either:
* gcc (gnu c compiler) - asks everyone else, here they implement new standards more fully, works in all OSes, but there is a windows assembly (look at mingw, by the way, it has it for all OSes, it allows cross-compilation of the type from linux to assemble windows exe) and there is cygwin (incompatible with anything, but qualitatively repeats linux standards)
They say that mingw is all over :(
* microsoft visual c++ compiler (comes with visual studio), tries to set its own incompatible standards, distorts existing ones, in order to create chaos and tie developers only to windows
, and this is what Microsoft does, unfortunately
* llvm and clang (these are separate projects, but when they talk about one and the other), the standard stands apart, since llvm is a kind of virtual machine, with a very efficient implementation, with jit and optimizations
, you still need to be able to configure it on windows, but there is the ability to prescribe for use in visual studio!

D
DimanCPlusPlus, 2021-07-01
@DimanCPlusPlus

I think you just compile and that's it

D
Drno, 2021-07-01
@Drno

Well, compile to a portable version. there will be an exe in the folder and all the necessary files for the program to work ... if it can do that, of course

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question