Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Howitzer 21 on September 28, 2014, 01:19:33 am

Title: In 2014, starting from default settings, clear steps to make only C code compile
Post by: Howitzer 21 on September 28, 2014, 01:19:33 am
It is September 27, 2014, and I re-installed Code::Blocks a few weeks ago.  I'm working pretty much exactly from the default, "normal" settings, and that includes using the GNU GCC Compiler to compile my projects.  That being said, what is a good, clear list of steps to make Code::Blocks only compile C code, instead of C++ code?

In other words, assuming this is still a syntactical feature of pure C, if I insert a blank space at the very beginning of a source file, I do not want it to compile.  I want gcc in Code::Blocks to behave exactly as a pure C compiler, and nothing more.

From what I understand, using .c for all the file extensions doesn't work, and though I would be tempted to use one of the answers here:

    http://forums.codeblocks.org/index.php?topic=15189.0;prev_next=next

I would prefer to first check and make sure.  Simply running tests isn't an accurate enough way to find out if one of the answers on that thread works, that thread's a few years old, and some of the answers are not completely specific.

Thank you.
Title: Re: In 2014, starting from default settings, clear steps to make only C code compile
Post by: stahta01 on September 28, 2014, 01:42:00 am
Read the CB FAQs then ask a smart Code::Blocks related question.

CB FAQs http://wiki.codeblocks.org/index.php?title=FAQ (http://wiki.codeblocks.org/index.php?title=FAQ)
CB Rules http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

http://www.catb.org/esr/faqs/smart-questions.html (http://www.catb.org/esr/faqs/smart-questions.html)

I have no idea what you are asking for; I suggest reading the links I have posted!

Tim S.

Title: Re: In 2014, starting from default settings, clear steps to make only C code compile
Post by: Howitzer 21 on September 28, 2014, 03:13:02 am
Tim, I checked those links out, and I don't believe this goes against the rules or ignores the FAQ in any way.

My question is how do you take the current version of Code::Blocks and its default settings, along with the GNU GCC Compiler, and tell it to only compile and link everything as C, not as C++?

The only things I'm seeing on the Internet so far are things that I don't trust, and it only takes the allowance of one obscure C++-specific feature to make the compilation not C-specific.  That's why I'm asking here.
Title: Re: In 2014, starting from default settings, clear steps to make only C code compile
Post by: stahta01 on September 28, 2014, 04:10:31 am
The only thing that really applies to Code::Blocks part of the answer is

Setting the CB Toolchain to NOT use the CPP compiler.

http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps)

The rest of your first post is NOT understandable!

They was NEVER a real C Compiler that did nothing because the source file had a space at the beginning of it!!

I have no idea if you know what a C Compiler is or what an IDE is.

Tim S.


Title: Re: In 2014, starting from default settings, clear steps to make only C code compile
Post by: edison on September 28, 2014, 07:32:38 am
Use .c as file extension.
Title: Re: In 2014, starting from default settings, clear steps to make only C code compile
Post by: stahta01 on September 28, 2014, 11:29:17 pm
Use .c as file extension.

CB Uses the C++ Compiler to do the linking; so, it needs changed to the C Compiler; But, if you do that and use a .c file extension then I think it will work correctly. But, I have no idea what the OP really wants the CB IDE to do.

Tim S.