Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: olspookishmagus on January 10, 2008, 12:11:24 pm

Title: Make Code:Blocks compile a C program, only with mingw-gcc
Post by: olspookishmagus 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?
Title: Re: Make Code:Blocks compile a C program, only with mingw-gcc
Post by: thomas 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".
Title: I've set everything up... I can't get to the "Toolchain Executables"
Post by: olspookishmagus 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:

(http://www.imageox.com/graphic/thumbs/156058-codeblocks-th.png) (http://www.imageox.com/share/156058-codeblocks.png)

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.
Title: Re: Make Code:Blocks compile a C program, only with mingw-gcc
Post by: thomas on January 10, 2008, 01:01:42 pm
"Programs"
Title: Re: Make Code:Blocks compile a C program, only with mingw-gcc
Post by: olspookishmagus on January 10, 2008, 01:17:17 pm
OK! With thomas help, I've done it. And here's what need to be done:

(http://www.imageox.com/graphic/thumbs/156065-codeblocks-th.png) (http://www.imageox.com/share/156065-codeblocks.png)

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

Thanks thomas! ;)