Author Topic: In 2014, starting from default settings, clear steps to make only C code compile  (Read 4231 times)

Howitzer 21

  • Guest
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.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Read the CB FAQs then ask a smart Code::Blocks related question.

CB FAQs http://wiki.codeblocks.org/index.php?title=FAQ
CB Rules http://forums.codeblocks.org/index.php/topic,9996.0.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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Howitzer 21

  • Guest
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.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline edison

  • Multiple posting newcomer
  • *
  • Posts: 53
Use .c as file extension.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org