Author Topic: Changing object file name  (Read 6275 times)

VCoder

  • Guest
Changing object file name
« on: March 06, 2010, 08:26:59 am »
hi everyone! i've just installed code::blocks on my ubuntu jaunty and have tweaked it to my liking. however, i haven't found the option to change the name of object file generated.

 i'm a student and write mostly beginner level programs. i don't need the .o and executable files once my programs output the expected results. i want a way to change the name of the .o and executable files to a.o and a.out. For instance, when i compile palindrome.c, 2 files are generated-- palindrome.o and palindrome.out. is there a way so that the generated filenames are a.o and a.out. this way my home folder will not be cluttered with multiple .o and .out files.

i did try to change settings in Settings->Compiler and Debugger->Other settings->Advanced options...and changed the command to  $compiler $options $includes -c $file from $compiler $options $includes -c $file -o $object but it doesn't seem to work.

Any help would be appreciated. Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Changing object file name
« Reply #1 on: March 07, 2010, 05:53:05 pm »
i did try to change settings in Settings->Compiler and Debugger->Other settings->Advanced options...and changed the command to  $compiler $options $includes -c $file from $compiler $options $includes -c $file -o $object but it doesn't seem to work.
If you replace $object with a.o and modify the linker command accordingly, too it should work. However - be careful! This completely breaks the build system if you want to use more than one object file.
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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7593
    • My Best Post
Re: Changing object file name
« Reply #2 on: March 08, 2010, 06:24:58 pm »
A better option might be to use Code::Blocks with a custom makefile

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Changing object file name
« Reply #3 on: March 08, 2010, 08:23:14 pm »
A better option might be to use Code::Blocks with a custom makefile
Indeed. I did't think of that at all.
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