How to pass g++.exe parameters to Code::Blocks?

I have been using CodeBlocks for a while now,and sometimes I have a problem.Its mostly associated with passing parameters to the g++ program.How do I pass parameters like -o or -fpermissive(which is the one I get the most while compiling) using CodeBlocks guys? Can you tell me? Thnx for the help!!
Short answer: in CodeBlocks, you don't need to pass -c or -o flags, as they are automatically passed to compiler by CodeBlocks. All you need to do is add your custom flags, which you can do in Options->Compiler by selecting corresponding checkboxes.

Long answer: Compiler flags allow you to define behaviour of compiler. Compiler is a tool designed to be used from command line. Windows is a operating system that is designed to be used from GUI only(it doesn't even have proper shell). Therefore, your graphical interface(CodeBlocks in this case) is merely eye candy. You select proper options, and it calls command line compiler with these options.

In big projects, compiling from command line gets hard, as command gets larger and larger. The solution is to use something like Make system - and afaik, CodeBlocks use make. It sets up makefile according to the internal template, and everything is working out of the box - you don't ever need to touch -c or -o options.

However, these options merely tell compiler what to compile. If you want to tell your compiler how to compile(e.g. "Show all warnings and use C++11 standard!"), you need to pass certain flags. CodeBlocks has these checkboxes you can select, and it will add flags automatically for you. However; your compiler might be newer then CodeBlocks and accept new flags you might want to use. In that case, you have an option to type any flags, and they will be passed to compiler. It should be located next to checkboxes(I'd say it would be named like Options->Compiler->Custom flags, but that's a blind guess).
Last edited on
Topic archived. No new replies allowed.