The SteelGolem Ruins
Tutorials



Dev-C++ Tutorial 3:
Turning On Warnings and Optimising Code

At the time I wrote this tutorial, I was using Dev-C++ version 4.9.7.3. If there are any differences in this tutorial and what you have, it means that either you or I don't have the most up-to-date compiler. Let me know if I'm behind!

Turning On Warnings

By default Dev-C++ isn't set to show every warning it should - which is ALL OF THEM. I personally like code that works properly, and I want the compiler to tell me anything I've done wrong if it knows about it, so I can fix it. If you don't like warnings this section isn't for you.

For Individual Projects

In order to get the maximum amount of warnings you can get out of your code, you need to compile with the -Wall switch, "warn about all". Open up or create a new project, anything will do. Click on Project > Project Options (alternatively, use Alt+P), click on the Compiler tab on the top, and then the Compiler Options tab on the bottom. Add the -Wall switch to the compiler textbox as shown below:

For All Projects

The above method will only be good for the current project. If you want to have it on for all projects, you need to set the switch in a different place. Open up Dev-C++ if it isn't already open, and click on Tools > Compiler Options. Be sure the 'Compiler set to configure:' is set to 'Default compiler'. The next section, 'Add the following commands when calling compiler:' is what we want. Put a checkmark in the box next to that line, and add -Wall to the textbox below it, as shown below:

Optimising Code

By default Dev-C++ doesn't apply any optimisation to projects either; compiling optimised code generally takes longer to do. This is something you have to set project-to-project, there is no way to set it for all projects that I know of. Open or create a project, click Project > Project Options, and click on the Compiler tab. Now in the tree in the left frame you'll see Optimization; click on it. This will bring up 'Perform a number of minor optimizations' option in the right frame. Click on the dropdown button and choose Yes. Back in the tree in the left frame, click on the [+] beside Optimization to expand it. Now click on Further optimizations. In the right pane there are three options, and only one can be Yes. I usually just pick the Best Optimization to set to Yes. I don't really know why you wouldn't want the Best Optimization if you were going to finish off your project, but I'm sure there's a reason they're there.

That's all there is for this tutorial. If you have any information about the above you feel I'm leaving out, leave me a message and I'll get it in here as soon as I can.