So I made a 2D adventure game using c++ and SFML with the Code::Blocks IDE and the GNU GCC compiler. I have been working on it for several months and been doing bug fixes and everything. I want to publish my game to steam, or maybe a website for people to download for free and enjoy my game. However I do not know how to take my code on Code::Blocks and put it into a single application that when double-clicked it can be opened and ran as a game. Please help, it would be greatly appreciated.

  • \$\begingroup\$ How have you been working with codeblocks/gcc for several months, to the point of completing a game, and not know that a build is generated every time you run it? That's at least strange. Yes, the build is generated when you press the |> "play" button. \$\endgroup\$ – Ferreira da Selva Aug 27 '18 at 2:04

Code::Blocks builds your project before running it, meaning that an actual executable file is created from time to time anytime you run your program.

It is usually located in the "Release" build target folder, inside the current project folder. If your project is named "MyGame", and it is located at "X:{Program Files}\CodeBlocks\Projects\MyGame", then you'll find your executable in the subpath "\bin\Release" (or Debug, if you never ran a Release build).

An alternate way to find such executable is to browse the file browser in the Management section of the IDE. In Windows it looks like this:

enter image description here

Expanding the "bin" folder you'll find the build target subfolders, inside which the executable is located. Right-click on it, and then click "Copy To..." and choose the Desktop or another folder of choice:

enter image description here

This example is about a simple console application, only difference with a full-working application is you must copy other included files as well.

| improve this answer | |
  • 1
    \$\begingroup\$ Also, for an official release build you probably want to run gcc (...or g++) with some more optimization (I tend to use the -03 flag). If you do not know how to do this, you should really read some more about compilation - it's a necessary evil! :) \$\endgroup\$ – Anonymous Anonymous Aug 28 '18 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.