title: How do I create a .exe from a .cpp file in Code Blocks?
body: <p>I've just started learning C++, and to display the outputs of code I found <a href="http://forums.codeblocks.org/index.php?topic=13175.0" rel="nofollow noreferrer">this method</a>. This worked when I first compiled Structure of a Programme.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main ()
  {
      cout &lt;&lt; "Hello World!";
      return 0;
  }
  </code></pre>
  
  <p>It gave me a .exe, which I opened, ran, and got a lovely 'Hello World!' appearing, but when I tried compiling a second one, Variables.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main ()
  {
      int a, b;
      int result;
  
      a=5;
      b=2;
      a=a+1;
      result=a-b;
  
      cout &lt;&lt; result;
  
      return 0;
  }
  </code></pre>
  
  <p>I didn't get a .exe at all, so couldn't work out how to open it. I tried re-compiling Structure of a Programme.cpp (after deleting all the associated files), but now that won't create a .exe anymore, either. The only files created are Structure of a Programme.o and Variables.o (in a sub-directory obj\Debug).</p>
  
  <p>The only question I could find that seemed similar was <a href="https://stackoverflow.com/questions/5150047/when-i-have-two-cpp-files-from-the-same-set-of-source-files-in-codeblocks-ho">this</a>, but the problem seems to be slightly different, and I tried deleting one of the files (so there was only one of Structure of a Programme.cpp or Variables.cpp in the folder) and I still had the same result.</p>
  
  <p>Also, there were no compiler errors with either file, and I don't think I changed any options in Code Blocks between Structure of a Programme working and everything not working.</p>
  
  <p>Thanks,</p>
  
  <p>Dalkius</p>
  
  <p>edit: Build logs:</p>
  
  <pre><code>Compiling: Structure of a Programme.cpp
  Process terminated with status 0 (0 minutes, 0 seconds)
  0 errors, 0 warnings
  
  Compiling: Variables.cpp
  Process terminated with status 0 (0 minutes, 0 seconds)
  0 errors, 0 warnings
  </code></pre>
  
  <p>edit 2: 'Full Commandline' build logs:</p>
  
  <pre><code>Build started on: 14-12-2011 at 07:57.39
  Build ended on: 14-12-2011 at 08:01.03
  -------------- Clean: Debug in cplusplus.com Tutorial ---------------
  Done. 
  mingw32-g++.exe -Wall -g -c "D:\My Documents\0HOME\Programming\C++\Code Blocks\cplusplus.com Tutorial\Structure of a Programme.cpp" -o "obj\Debug\Structure of a Programme.o"
  Process terminated with status 0 (0 minutes, 1 seconds)
  0 errors, 0 warnings
  mingw32-g++.exe -Wall -g -c "D:\My Documents\0HOME\Programming\C++\Code Blocks\cplusplus.com Tutorial\Variables.cpp" -o obj\Debug\Variables.o
  Process terminated with status 0 (0 minutes, 0 seconds)
  0 errors, 0 warnings
  </code></pre>