News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Different method of compiling

Started by xylon97, June 23, 2013, 04:48:55 PM

Previous topic - Next topic

xylon97

Hello, I have a C file which code blocks runs like this -


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.

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

xylon97

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

oBFusCATed

Quote from: xylon97 on June 25, 2013, 02:30:10 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).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

MortenMacFly

Quote from: oBFusCATed on June 25, 2013, 02:40:41 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]