News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Make Code:Blocks compile a C program, only with mingw-gcc

Started by olspookishmagus, January 10, 2008, 12:11:24 PM

Previous topic - Next topic

olspookishmagus

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:

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?

thomas

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

olspookishmagus

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.

thomas

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

olspookishmagus

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! ;)