User forums > Using Code::Blocks

Forcing ANSI C standard only.

<< < (2/3) > >>

codeur:
Assuming that you use the GNU GCC Compiler:
For a supportive ansi C learning environment you will need to tick the following compiler flags in menu [Project]->[Build Options]:

- In C mode, support all ISO C programs...  [-ansi]
- Enable all compiler warnings... [-Wall]
- Enable warnings demanded by strict ISO C and... [-pedantic]

Never forget to create a project with these flags for every program that you build, even when there is only a single source code file in the project.

Alternatively:
If you always want this setup without having to set the flags for every new project, tick the same flags in the global compiler settings instead:
Go to menu [Settings]->[Compiler and debugger], then with the GNU GCC compiler selected, tick those same flags under the "Compiler Flags" tab.

@ Morten
Most C educational environments now use the ISO C99 standards instead of ansi.
The GCC flag -std=c99 is not available in the Codeblocks project build options and would be needed for those cases instead of -ansi.

I think that -std=c99 is worth adding to the compiler flag options for GCC and the equivalent for other compilers.

oBFusCATed:
I disagree, they should also learn where to put the "other options" :)

codeur:

--- Quote from: oBFusCATed on August 12, 2011, 02:58:01 pm ---I disagree, they should also learn where to put the "other options" :)

--- End quote ---
That colleague of mine (C teacher) also thinks that they should learn to compile and link from the command line and learn to edit with vi.  :?

oBFusCATed:
He is wrong only about the last part :)
The compile and link part is really needed:)

codeur:
There is some truth in that oBFusCATed, but that teacher is not developing an IDE, you are.

However the beauty of open source is shown in action here. If some people think that a particular compiler flag is important for C programmers and an IDE developer does not want to make the flag available up-front in the IDE for whatever reason, these people can always add that flag, then distribute the modified IDE and the associated patch.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version