Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: abaux on March 31, 2016, 10:38:41 pm

Title: How to auto delete .o file after being compiled?
Post by: abaux 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: oBFusCATed 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: abaux 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: stahta01 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: abaux 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!
Title: Re: How to auto delete .o file after being compiled?
Post by: raynebc 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: scarphin 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: abaux 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.
Title: Re: How to auto delete .o file after being compiled?
Post by: stahta01 on April 02, 2016, 04:16:20 am
http://wiki.codeblocks.org/index.php/Creating_a_new_project (http://wiki.codeblocks.org/index.php/Creating_a_new_project)