Code::Blocks

User forums => Help => Topic started by: staloysius333 on October 10, 2005, 05:23:44 pm

Title: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 10, 2005, 05:23:44 pm
Hi.  I have noticed that CBs does not appear to catch when a .h file has been changed and does not re-compile the .cpp files automatically  that depend on it.  How do I get CBs to notice when a .h has changed and re-compile ALL .cpp files that depend on it?  Thanks so much!  I've searched for an answer to this question but I am unable to find one.  Sorry if this is a repost.  I hope it's not. :D
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 10, 2005, 05:45:49 pm
Platform?
Build method? (Settings->Compiler->Other->Build method)
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 10, 2005, 05:55:24 pm
Platform: WinXP,  Build method? Humm.... "Invoke Compiler directly"

Does this help?

--Allen
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 10, 2005, 07:03:40 pm
Platform: WinXP, Build method? Humm.... "Invoke Compiler directly"

Does this help?

Hmm, the "direct mode" is known to work flawlessly as far as dependencies are concerned. I find it odd that it's not working for you. It's the first time I hear this and I have never noticed it myself...
Can you post your project file?
Title: Re: Dependency Checking & chaning of .h files.
Post by: rickg22 on October 10, 2005, 11:47:47 pm
Maybe the .h file in question is NOT included in the project...
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 11, 2005, 12:18:11 am
Maybe the .h file in question is NOT included in the project...

It doesn't matter. The dependency checker scans each file and checks the #included files' modification dates. The only thing that matters is the compiler include dirs being correctly set-up (so that the checker can locate the files - if it doesn't, it assumes they 're not updated).
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:36:14 pm
Humm, I know the .h files are in the project correctly, else none of my code would compile at all or build.  Unfortunately, I can not post my project because it is "sensitive" to my company's growth.  But I can give screen shots of my set up.  Here they are.  If I have incorrectly setup the header info - or anything else - please, let me know.  I'll change what I'm doing ASAP.  Thanks so much for the help.  It is MuCH appreciated!  :D

I have nothing in "Custom Variables".  The Screen shots I've included are of my compiler setup as well as my project setup.  Also, it is good to know, my "Headers" are all "summed up" in ONE header that is included in all of my .cpp files.  Another words, in my cpp's, I include only one header, which includes all of the other headers needed by all the source code files.  Is that a problem?

(This is going to be hard.  I have a Lot of screen shots but can only post - it seems - one at a time.

--Allen

[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:37:39 pm
More screen shots.

[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:38:18 pm
more shots

[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:38:45 pm
more...

[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:39:19 pm
more

[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 11, 2005, 05:40:22 pm
Thank you for all the help guys!  :D

Sincerely, Allen
Title: Re: Dependency Checking & chaning of .h files.
Post by: rickg22 on October 11, 2005, 06:34:40 pm
Question - where is the file-in-question located? Mind showing the modification datetime? The compile log?
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 11, 2005, 06:40:26 pm
Quote
(This is going to be hard.  I have a Lot of screen shots but can only post - it seems - one at a time.

In the "reply" form, click "additional options" (you did that to attch a file) and click "more attachments" to add more than one file...

Quote
Thank you for all the help guys!

I see that you 're using the global compiler options to setup your project. That is plain wrong. In global options you should put settings that should be, err, global  :shock:

Try setting the project and target options, available through "Project->Build options" and remove those settings from the global options (I 'm talking about compiler flags, includes, libs, etc).
I bet that your problem will be solved.
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 14, 2005, 04:54:47 pm
Ok, thank you.  File in question.  Compile logs.  Lets see what can do....  & about the global stuff, that sounds really good.  I'll be sure to try that.  Ah, the files in question, the Compile log will, of course, only show what's been compiled but the files in question are my headers.  One header contains all the others, itfp.h.  I'll attached a pic of that too.  I hope this makes it in this post.  The last ones forced me to make multiple posts because of the "size" of the pics.



[attachment deleted by admin]
Title: Re: Dependency Checking & chaning of .h files.
Post by: rickg22 on October 14, 2005, 05:19:37 pm
Thank you, but we'd appreciate it if the screenshots were legible the next time :lol:

Anyway, try to enable the "Full Commandline" logging in the compiler advanced options. Also, the compiler log can be copy / pasted with right-click.
Title: Re: Dependency Checking & chaning of .h files.
Post by: grv575 on October 15, 2005, 02:06:40 am
Just reading through this, it sounds like the dependency checker checks .c .cpp etc files for #includes and ensures recompilation if any of them have changed.

But is this recursive?  If a header not directly #included in a .c .cpp file but (#included in an #included header), then does it catch this or no?
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 15, 2005, 09:38:03 am
As said before, of course it's recursive. But the compiler include dirs for the project must be setup correctly so that it can really locate the files...

I 've told it before: set the project include dirs correctly and it 'll work. The dependency checker does not follow global include dirs...
Title: Re: Dependency Checking & chaning of .h files.
Post by: grv575 on October 16, 2005, 01:28:58 am
OK, but say I don't set the include dir for each file I include, but I add them to the project.  Will the recursive #include checking look here as well (I assume yes but just to be sure)?
Title: Re: Dependency Checking & chaning of .h files.
Post by: mandrav on October 16, 2005, 10:09:00 am
OK, but say I don't set the include dir for each file I include, but I add them to the project. Will the recursive #include checking look here as well (I assume yes but just to be sure)?


I 'll say it in a different way: dependency-checking is reliable and works as long as your project compiles without errors about missing #includes.
In other words:  if the compiler can find your files, C::B can too. The only difference is that C::B will not search in dirs defined in the global compiler options.

I hope it's clear enough now.
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 17, 2005, 05:08:42 pm
Cool,  now I begin to understand.  The project must be set up correctly & ! the Global prefs.  Ok, thanks.  That, I believe answers my ? and I'll certainly try that.

About the "unreadable" jpg. Sorry, but that's the biggest I could get it to be accepted by the site.  I only allows a 128k size pic and mine was acutally around 3k in size.  Ah well,

Thanks so much for the insight.  I'll certainly try it!  :D

--I also appreicate you patience & willingness to answer my ?'s.   8)

--Allen
Title: Re: Dependency Checking & chaning of .h files.
Post by: thomas on October 17, 2005, 05:33:28 pm
About the "unreadable" jpg. Sorry, but that's the biggest I could get it to be accepted by the site.  I only allows a 128k size pic and mine was acutally around 3k in size.  Ah well,

Try www.imageshack.us next time :)

1024kb max. filesize, free of charge, plus it saves bandwidth and storage for the forums ;)
Title: Re: Dependency Checking & chaning of .h files.
Post by: staloysius333 on October 17, 2005, 06:39:58 pm
Never heard of it!  Way cool & then I wouls suspose that I'd put in a link to it so that the pic can be seen.

Excellent!  :D

--Allen