User forums > Using Code::Blocks

Set to ANSI C standard?

(1/5) > >>

drewvoros:
Hello knowledgeable forum members,

I'm starting an intro to C course this semester and am required to use a compiler that is ANSI C standard.

The Prof. requires ANSI C standard and requests the class use C-Free. However I've used Code::Blocks before and much prefer it (one thing being the helpfulness of how it completes common syntax and other useful tidbits like automatically inserting closing brackets... both of which C-Free does not do)

So I will be using the GNU GCC compiler but how do I make sure it is ANSI C standard?
I don't know much about the intricacies of compilers but know from my previous experience with C++ (a previous intro class taken a while back) that the GNU GCC worked great.

Just need to really make sure that what I'm using is ANSI C standard. Otherwise it's not allowed for the course  :(

Note: I'm told C++ compilers work with C code. I don't want to run into the problem of thinking my programs are running fine because I'm not compiling in strict ANSI C standard and then when I turn in the programs don't run on the Prof.'s computer after he complies in ANSI C standard.

Any instruction would be great!

stahta01:
--ansi option is the common option; please confirm this is the right option for your Compiler.
Note: CB is an IDE; it is NOT a compiler.

Look for the option under Compiler Setting if NOT there add under Compiler other options.

Tim S.

thomas:
How nice of your prof to use a word like "ANSI" which is not at all ambiguous, except for allowing for at least 4 different language versions...

There's at least c89, c90, c99, and c11 to choose from, all of which are ISO/IEC/ANSI.

You can select "mostly" ANSI C90 mode in GCC with --ansi, this is equivalent to --std=c90. If a newer version (like e.g. c99) is allowable, use --std=c99 instead.

It is a good idea to add -pedantic-errors to make the compiler behave more strictly, since it still allows a couple of GNU extensions even in ANSI mode otherwise.

drewvoros:
Hi Tim,
I understand CB is an IDE and not compiler. Still not sure about confirming that I will be in fact compiling in strict "ANSI C standard".

Hi Thomas,
Wish I knew more but all my syllabus says is must be strict "ANSI C standard... recommend you all use what I will be using C-Free"

Still not sure where to set. I'm assuming under Project > Build Options > ... then I get the attached image. What do I need to check to make sure?

BlueHazzard:

--- Quote from: drewvoros on January 29, 2015, 06:12:32 pm ---Hi Tim,
I understand CB is an IDE and not compiler. Still not sure about confirming that I will be in fact compiling in strict "ANSI C standard".

--- End quote ---
No you are not, because otherwise you wouldn't ask this question  ;)


--- Quote from: drewvoros on January 29, 2015, 06:12:32 pm ---recommend you all use what I will be using C-Free"

--- End quote ---
As far as i can see C-Free is also only a IDE and not a compiler (and also not shipped with one), so how will your prof say that it is 100% ANSI C?


--- Quote ---Still not sure where to set. I'm assuming under Project > Build Options > ... then I get the attached image. What do I need to check to make sure?
--- End quote ---
This is the right place. You need the -ansi option

[Edit:] or the options Thomas mentioned...  but we don't know, because your prof is unclear in this point (C90, C99, C11 -> All ANSI standards)

Navigation

[0] Message Index

[#] Next page

Go to full version