Author Topic: How to auto delete .o file after being compiled?  (Read 3123 times)

Offline abaux

  • Single posting newcomer
  • *
  • Posts: 4
How to auto delete .o file after being compiled?
« on: March 31, 2016, 10:38:41 pm »
I just switched over from Dev C++ today and I am trying to figure out how to get the .o files to get deleted after being compiled.  With Dev C++, whenever I compiled it simply just gave me the .exe, that is all I want.  I have no use for the .o file, have no idea what it really is (only that is is necessary for compiling), and it is just making my folder unorganized with more files.  I never use projects, just a single .cpp and .exe file per program, plain and simple.  So how can I make it like Dev C++ where there are no .o files after being compiled? Thanks in advance.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11719
    • Travis build status
Re: How to auto delete .o file after being compiled?
« Reply #1 on: March 31, 2016, 11:47:47 pm »
Just live with it... This is how cb builds programs... The power of codeblocks is when you use a project. Then the object files are useful.
(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 abaux

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to auto delete .o file after being compiled?
« Reply #2 on: March 31, 2016, 11:53:16 pm »
There has to be a way though.  Many people in this forum know this program inside out.  I think I might be able to achieve this by messing with something in the advanced options in the compiler settings.  Both code blocks and Dev C++ use MinGW so there must be a way... Shouldn't be too hard, but I am new to code blocks.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6511
    • My Best Post
Re: How to auto delete .o file after being compiled?
« Reply #3 on: April 01, 2016, 02:52:09 am »
There has to be a way though.  Many people in this forum know this program inside out.  I think I might be able to achieve this by messing with something in the advanced options in the compiler settings.  Both code blocks and Dev C++ use MinGW so there must be a way... Shouldn't be too hard, but I am new to code blocks.

Since, you refuse to use a CB project the only solution is to edit Code::Blocks yourself and build Code::Blocks after adding this feature.

Doing that would be a waste of time in my view; but, I have done a lot of things that others considered a waste of time. Feel free to waste your own time.
But, do NOT feel free to waste anybody else's time!

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

Offline abaux

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to auto delete .o file after being compiled?
« Reply #4 on: April 01, 2016, 03:32:04 am »
Okay, just wanted to see if there was just a simple solution to it, but apparently not.  I guess I will learn to live with it, I like Code::Blocks a better than Dev C++, so it's not too much of a big deal.  Thanks guys for the information, feel free to close/delete/archive/whatever this thread. Cheers!

Offline raynebc

  • Almost regular
  • **
  • Posts: 192
Re: How to auto delete .o file after being compiled?
« Reply #5 on: April 01, 2016, 09:04:21 am »
Once you learn why it's helpful to keep object files, you won't mind them.  You can have your program's executable file put in an entirely different folder so you don't even have to see them if that's what you prefer.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: How to auto delete .o file after being compiled?
« Reply #6 on: April 01, 2016, 01:45:55 pm »
Deleting the object files may be possible by adding post-build steps and using CB's predefined macros but I believe it is not worth even the simplest effort as they are generated in a different folder which you can completely get rid of when you are done with your project/files. If you code only single source programs, you may choose to create a project and add a new target for every new program so you only have one project and many single source targets which may keep your files tidy enough.

Offline abaux

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to auto delete .o file after being compiled?
« Reply #7 on: April 02, 2016, 12:02:07 am »
I have all my .cpps and .exes in one folder that I use to store all my programs so I am not accustomed to the .o files with CB.  I am just a hobbyist programmer, nothing formal or advanced which is why I never use projects or anything.  So how can I go about separating the exe and source from the object file raynebc?  That would make my folder a lot more organized.  Sorry if it is a very basic question, like I said I just started using CB and I am not very skilled at setting up IDEs.  I took me 3 days to finally figure out how to install libcurl. Scarphin, deleting the object files sounds too complex for what its worth so if it is easier just to generate them in another folder, that would be great.  Thanks everyone for the help.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6511
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org