1. From the main menu select Settings|Compiler and debugger
  2. Make sure your Selected compiler is the compiler you plan to use.
    Mine is the “GNU GCC Compiler” option.
  3. Click the Toolchain executables tab.
  4. Make sure the Compiler’s installation directory is correct.
    I keep my MinGW in C:\Program Files\MinGW , but most users will have it in the default installation path:C:\MinGW If you are using another compiler, for example, CodeGear Turbo C++ Explorer, make sure you’ve got its installation directory listed C:\Program Files\Borland\BDS\4.0
  5. In the Program Files tab, make sure each item correctly identifies the executable. Mine uses all the default stuff for GCC:
    1. C Compiler: mingw32-gcc.exe
    2. C++ Compiler: mingw32-g++.exe
    3. Linker for dynamic libs: mingw32-g++.exe
    4. Linker for static libs: ar.exe
    5. Debugger: gdb.exe
    6. Resource compiler: windres.exe
    7. Make program: mingw32-make.exe

    Again, if you are using something different, make sure you’ve got the correct executables. For TC++Explorer you’ll want to make sure you’ve got something like:

    1. C++ Compiler: bcc32.exe
    2. Linker for static libs: ilink32.exe
    3. Resource compiler: brcc32.exe
    4. Make program: make.exe

    Et cetera.
    If you aren’t using the GCC you’ll also want to make sure you’ve got the proper global variables set up. See here for more.

  6. Test compile something simple to make sure you’ve got it working.

Now, to add a main icon resource to your program, a quick walk-through:

  1. Create a New Project… and choose a Console application. This will give you a default main.cpp that simply prints “Hello world!”.
  2. Find or create an icon to represent your application. Add it to your project. Mine is named spiffomatic.ico .
  3. Create a new file in your project named resources.rc . It doesn’t have to be named “resources”, but that’s what I chose.
  4. Add the following line to resources.rc :
    1. MAINICON ICON "spiffomatic.ico"

    Notice how I gave the filename of the icon file I added to the project? Save all changes.

  5. At this point the Projects Management pane on the left should look something like this:
    1. [-] Workspace
    2. [-] Spiffomatic
    3. [-] Sources
    4. | |_ main.cpp
    5. [-] Resources
    6. | |_ resources.rc
    7. [-] Others
    8. |_ spiffomatic.ico
  6. Hit Ctrl-F9 (or Build|Build from the main menu).

You should now be able to navigate to your application’s EXE using Windows Explorer and see it represented with the icon you selected for it. If compilation fails, make sure you have all the compiler options correct and try again.

Another path would be to just download Resource Hacker and use it to modify your EXE directly.

Good luck!

Advertisements