No There is no way to generate an executable from the application itself without resorting to the compiler by command line: the compiler is an executable and requires to be invoked, surely by means of a call to system
.
I see that you have tagged the question with , so I assume you intend to use the compiler of visual-studio . As you indicate, " each person may have the compiler in a different route " but this has already been taken into account by the Microsoft team, which has prepared a guide configure the compiler by command line (highlighted by me):
When choosing one of the C ++ workloads in the Visual Studio installer, install the Visual Studio platform toolset . A set of platform tools has C and C ++ tools for a specific version of Visual Studio, including C or C ++ compilers, linkers, assemblers, and other compilation tools , as well as libraries Match search. You can use all these tools on the command line , and they are also used internally by the Visual Studio IDE.
To work properly, the tools require several specific environment variables to be set . They are used to add them to the path and set include SDK locations, library file and files. To make it easier to define these environment variables, the installer creates custom scripts , or batch files, during installation. You can run one of these command files in a command prompt window to set a specific host and target compilation architecture, version of the Windows SDK, target platform, and the platform toolset .
The required environment variables are specific to the installation and the compilation architecture you choose and you can change the product updates. Therefore, it is recommended to use one of the installed symbol shortcuts or command files instead of setting the Windows environment variables .
Proposal.
It is going to be necessary to follow the configuration guide on all the machines that you want to launch the compilation, once the destination machine is configured to compile: make the call system
to launch the compilation.