Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: wfws on April 08, 2014, 10:12:40 pm

Title: How do I set C::B to use std=c99 GLOBALLY
Post by: wfws on April 08, 2014, 10:12:40 pm
I'm new to code::Blocks, and so far so good!  I'm a student, and I will be compiling ALL of my C projects usng the -std=c99 flag. 
I know how to set that for each project.  My question is:  How do I set the -std=c99 flag for ALL projects- that is GLOBALLY. 

Many thanks! 
 :)
Title: Re: How do I set C::B to use std=c99 GLOBALLY
Post by: stahta01 on April 08, 2014, 10:21:21 pm
I'm new to code::Blocks, and so far so good!  I'm a student, and I will be compiling ALL of my C projects usng the -std=c99 flag.  
I know how to set that for each project.  My question is:  How do I set the -std=c99 flag for ALL projects- that is GLOBALLY.  

Many thanks!  
 :)

Duplicate a Compiler setting.

Change the new Compiler to have the GLOBALLY settings you want.

Remember to set this new compiler as default.

Remember to exit CB and restart CB (This is because some CB versions have issues using a new/duplicated/renamed Compiler until after reboot).

1. "Settings" -> "Compiler"
2. Select the compiler to duplicate.
3. Click on copy
4. Enter name I used "GNU GCC Compiler C only"
5. Toolchain executable change linker from "mingw32-g++.exe" to "mingw32-gcc.exe" needed to use C linker instead of C++ linker
6. add "--std=c99" to "Other options" without the double quote under Compiler Settings.
7. Set compiler as default
8. exit and restart CB

Tim S.
Title: Re: How do I set C::B to use std=c99 GLOBALLY
Post by: Alpha on April 08, 2014, 11:14:36 pm
Note that, assuming you are using 13.12 (or newer), Code::Blocks will filter C/C++ exclusive flags respectively, so duplicating the compiler *probably* is not necessary.
Title: Re: How do I set C::B to use std=c99 GLOBALLY
Post by: wfws on April 10, 2014, 12:19:04 am
Thanks that fixed me.  I'm sure I'll have more questions.  Thanks for the quick reply!