title: Creating a CUSTOM exe file in C++
body: <p>I'm working on a simple game engine just for the experience of it. I've realized, though, that I have no idea how to export the user's custom game as its own standalone executable. For example (this is not my actual game engine, it just provides an easy reference for discussion), suppose we had the following very simple code:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void RunGame(string question, string answer)
  {
      string submission;
      cout &lt;&lt; question &lt;&lt; endl;
      getline(cin, submission);
      if (submission == answer)
          cout &lt;&lt; "Correct!";
      else
          cout &lt;&lt; "Wrong!";
  }
  
  int main()
  {
      string question;
      string answer;
  
      cout &lt;&lt; "Enter Question:" &lt;&lt; endl;
      getline(cin, question);
      cout &lt;&lt; "Enter Answer:" &lt;&lt; endl;
      getline(cin, answer);
  
  
      RunGame(question, answer);
  }
  </code></pre>
  
  <p>In this example the user gets to create their own customized bit of trivia, and then can test it immediately afterwards when RunGame is called. Now I want to be able to save their game with the trivia information they provided as its own .exe (basically it will perform from the call to RunGame onwards). How would I go about doing that?</p>
  
  <p>To be clear, this isn't a question about what is the easiest/fastest way to make a game. It is looking for how to build a standalone, executable file from within code.</p>