News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

In 2014, starting from default settings, clear steps to make only C code compile

Started by Howitzer 21, September 28, 2014, 01:19:33 AM

Previous topic - Next topic

Howitzer 21

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.next.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.

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Howitzer 21

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.

stahta01

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

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.


C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]


stahta01

Quote from: edison on September 28, 2014, 07:32:38 AM
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]