开发者

Compile a .cpp file to an EXE inside of a program (EXE file) [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to make a program (EXE file) that will take the user defined settings and开发者_如何学Python make a custom (EXE) file for the user inside of the previously mentioned program (EXE). Is there like a portable GCC or something?

Please be as detailed as possible. I am not really sure where to start with this one.


The compiler itself is just another program which reads some input (source code) and writes some output (object code, or executable if it runs the linker too). You can use something like the system() call to execute a compiler, for example with gcc:

system("g++ -o test test.cpp");

That will run the compiler (g++), telling it to create an output file with a specific name (-o test) using the named source file (test.cpp).


Your best bet for this is to use an embedded resource - then use e.g. BeginUpdateResource and related functions to modify a precreated EXE file. The MSDN overview of resources contains the information you need to add a RT_RCDATA block to your EXE, retrieve its contents run-time, and modify its contents from another program.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜