Author Topic: Different method of compiling  (Read 4315 times)

Offline xylon97

  • Single posting newcomer
  • *
  • Posts: 2
Different method of compiling
« 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Different method of compiling
« Reply #1 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.
(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!]

Offline xylon97

  • Single posting newcomer
  • *
  • Posts: 2
Re: Different method of compiling
« Reply #2 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Different method of compiling
« Reply #3 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).
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Different method of compiling
« Reply #4 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ