Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Sagaceil on September 23, 2014, 11:04:28 PM

Title: Build force to compile all cpp's
Post by: Sagaceil on September 23, 2014, 11:04:28 PM
Hi !

I'm dealing with some anoying issue. When I do some minor change in one cpp file, and try to build project it recompiles all cpp units. I have proper PCH file (as said here http://wiki.codeblocks.org/index.php?title=Precompiled_headers , with generated gch file ).

Does something need to be set in C::B or in build setting ? Its really paint in the ass to wait several minutes and see how ~800 cpp's are compiling just to check little change :p

Thanks for any help !
Title: Re: Build force to compile all cpp's
Post by: stahta01 on September 23, 2014, 11:16:14 PM
If you change only what is in a cpp file then you should NOT have to build all the cpp files.
NOTE: If you change what is included inside a header than every file that includes that header needs to be recompiled.

Did not read the PCH info on link; but, you should know that much of the info on the web is incomplete.

MinGW GCC only uses a PCH file with included first thing in a compilation unit!
This means including a PCH file from inside a header is a waste of time!.
Edit: It also means you can NOT include another file before the PCH file.

Some #pragmas can NOT be before the including of a PCH file.

NOTE: Some headers can NOT be included inside a PCH file because the header does some operations not supported by MinGW GCC.

Tim S.
Title: Re: Build force to compile all cpp's
Post by: Sagaceil on September 23, 2014, 11:54:26 PM
Yup, I have arleady setup all the things you mentioned : the very first include in every cpp, classic #ifndef/endif guards, no PCH includes in any headers (only cpp's). Choosing proper PCH location in Build Options makes different (using 'Generate PCH in a directory alongside the original file' speeds up like 2x, so somehow PCH works).


-------------- Buduj: EditorFull in BarokEngine (compiler: GNU GCC Compiler)---------------

[  0.0%] Pre-compiling header: build.h

.... another gazilion cpp units ;P

[100.0%] Konsolidacja plik wykonywalny: HostApp.exe


As I imagine, there should be only that cpp files in the log that were actually changed ? I'm aware of changing header file forces the recompile all dependcies.
Title: Re: Build force to compile all cpp's
Post by: stahta01 on September 24, 2014, 12:01:39 AM
Are you positive you are doing build instead of rebuild?

If you do a second build right after the first, does it say nothing to be done or what?

Tim S.
Title: Re: Build force to compile all cpp's
Post by: oBFusCATed on September 24, 2014, 01:19:58 AM
Just a note: When asking for help it is best to post logs and error messages in english and not in your native language... The chance for someone to help you is quite a lot higher.
Title: Re: Build force to compile all cpp's
Post by: Jenna on September 24, 2014, 05:58:54 AM
You might get such issues, if you have your files on a network server with different time settings.
Title: Re: Build force to compile all cpp's
Post by: Sagaceil on September 24, 2014, 09:06:01 AM
Quote from: oBFusCATed on September 24, 2014, 01:19:58 AM
Just a note: When asking for help it is best to post logs and error messages in english and not in your native language... The chance for someone to help you is quite a lot higher.
Yeah, sorry for that, just quickly copy-pasted it. Didn't noticed that language changed ;) The last log at [100%] is just simply telling that now is linker time ;)

Quote from: jens on September 24, 2014, 05:58:54 AM
You might get such issues, if you have your files on a network server with different time settings.
Its not the case here. But I've checked timestamps and headers doesn't changed at all. Even turned autosave for sure.

Quote from: stahta01 on September 24, 2014, 12:01:39 AM
Are you positive you are doing build instead of rebuild?
If you do a second build right after the first, does it say nothing to be done or what?
Yes, I'm sure ;) Should there will be promnt to ask to build project when using Run after the code changed ?