Author Topic: Make Code:Blocks compile a C program, only with mingw-gcc  (Read 6188 times)

Offline olspookishmagus

  • Single posting newcomer
  • *
  • Posts: 5
Make Code:Blocks compile a C program, only with mingw-gcc
« on: January 10, 2008, 12:11:24 pm »
Hello once more and wishes for a productive and creative new year.

I am using Code:Block in Windows and I was looking on how to make it compile C code by using mingw32-gcc (and not mingw32-g++). Mingw32-g++ is not installed at all and whenever I try to compile C code the build log reads:

Code
Compiling: C:\Documents and Settings\olspookishmagus\Desktop\foo.c
Execution of 'mingw32-g++.exe   -c "C:\Documents and Settings\olspookishmagus\Desktop\foo.c" -o "C:\Documents and Settings\olspookishmagus\Desktop\foo.o"' in 'C:\Documents and Settings\olspookishmagus\Desktop' failed.

As you can see Code:Blocks tried to compile this using mingw32-g++.exe which is not installed at my system (my goal is to create a minimal IDE for compiling C code) so the question is... How can I instruct Code:Blocks to use only mingw32-gcc?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Make Code:Blocks compile a C program, only with mingw-gcc
« Reply #1 on: January 10, 2008, 12:21:28 pm »
If everything is set up, this should already work.
Anyhow, you can configure it under "Compiler Options", in the tab "Toolchain Executables".
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline olspookishmagus

  • Single posting newcomer
  • *
  • Posts: 5
I've set everything up... I can't get to the "Toolchain Executables"
« Reply #2 on: January 10, 2008, 12:55:22 pm »
Thanks for the quick answer.

Let me explain what I did to set Code:Blocks up.

First, I downloaded the automated setup of mingw which it got installed with no additional packages at all besides: mingw-runtime, w32api, binutils, gcc-core.
Then I downloaded the Code:Blocks 1.0rc2 installer which I also installed with no additional packages at all.
When I first run Code:Blocks it asked me for the compiler to use and I picked Gnu GCC. I also changed the path of the programs to match the one I picked.

Now whenever I click on Settings -> Compiler I get to see the following image:



I can't see where to configure what thomas has suggested and I can't see "Toolchain executables" at all.

I feel that I must also have mingw32-g++ installed so that I can compile a C program, Code:Blocks will compile it with the -c flag, but I believe this is not needed so I am working on it.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Make Code:Blocks compile a C program, only with mingw-gcc
« Reply #3 on: January 10, 2008, 01:01:42 pm »
"Programs"
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline olspookishmagus

  • Single posting newcomer
  • *
  • Posts: 5
Re: Make Code:Blocks compile a C program, only with mingw-gcc
« Reply #4 on: January 10, 2008, 01:17:17 pm »
OK! With thomas help, I've done it. And here's what need to be done:



You set: C compiler, C++ compiler and Linker for dynamic libs to point to mingw32-gcc.exe.

Thanks thomas! ;)