Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: xylon97 on June 23, 2013, 04:48:55 pm

Title: Different method of compiling
Post by: xylon97 on June 23, 2013, 04:48:55 pm
Hello, I have a C file which code blocks runs like this -

Code
gcc.exe    -c file.c -o file.o
mingw32-g++.exe  -o file.exe file.o

I want it to to run it like I do at at command line.

gcc file.c -o file
file

Is this possible in code blocks?
Also, it is just a common file, not in a project.
Title: Re: Different method of compiling
Post by: oBFusCATed on June 23, 2013, 05:32:19 pm
Settings -> Compiler -> Your default compiler -> Toolchain executable -> Linker -> mingw32-gcc.exe

But if you intend to make c++ project your linking will fail.

p.s. next time search the forum, it has been answered many times.
Title: Re: Different method of compiling
Post by: xylon97 on June 25, 2013, 02:30:10 pm
@obfuscated, I have already set that.

What I basically want is only file.exe to be created when compiling, not file.o, and code blocks always creates a ".o" file as well.

Anyways, its just whim of mine, I can live with the ".o" files as well, just think they are useless.
Code blocks is a mighty good ide otherwise.
Title: Re: Different method of compiling
Post by: oBFusCATed on June 25, 2013, 02:40:41 pm
What I basically want is only file.exe to be created when compiling, not file.o, and code blocks always creates a ".o" file as well.
No, I don't think it would be possible without massive changes to the compiler plugin (but I'm not compiler plugin expert).
Title: Re: Different method of compiling
Post by: MortenMacFly on June 25, 2013, 06:24:04 pm
No, I don't think it would be possible without massive changes to the compiler plugin (but I'm not compiler plugin expert).
It is possible by defining a Tool command (actually compiler command) that uses macros - i.e. the currently open / active editor.

Look at the tools/tools+ plugin (docs).