Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: VCoder on March 06, 2010, 08:26:59 am

Title: Changing object file name
Post by: VCoder 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.
Title: Re: Changing object file name
Post by: MortenMacFly 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.
Title: Re: Changing object file name
Post by: stahta01 on March 08, 2010, 06:24:58 pm
A better option might be to use Code::Blocks with a custom makefile

Tim S.
Title: Re: Changing object file name
Post by: MortenMacFly 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.