Author Topic: C::B Global variables issue  (Read 4873 times)

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
C::B Global variables issue
« on: August 18, 2006, 10:32:08 am »
Hi all,

A great feature of C::B is the global variables -  I stumbled upon it when messing around with the OGRE projects, so my grasp of the subject may be incomplete.

I can successfully use the hady global variables to direct the compiler and linker to the files required for a project. If I rebuild the entire project everything works as expected, but if I make a change to a header which is pointed to by a global variable the compiler does not rebuild the any of the cpp's which include the modified header.

I'll try to clarify by means of an example:

Supposing we were creating a static library MyLib, and its directory structures looks something like this:

MyLib
+source
+include
+lib

In order for the compiler to compile MyLib we would use MyLibDir in the [Build Options]->[Directories] as follows:
[Build Options]->[Directories]->[Compiler]    $(#MyLibDir.include)

If we try building MyLib everything works and links and there's happiness and cheering all around. Until, that is, we start making changes to the header files in MyLib\Include and press the build button. The build simply returns with "Target is up to date. Nothing to be done."
If however we used a relative path (eg. "..\include") in the  [Build Options]->[Directories]->[Compiler] settings the project would rebuild and compile as expected.

Am I using global variables incorrectly or is this a bug??

Thanks
Nix

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #1 on: August 18, 2006, 10:40:41 am »
Quote
Am I using global variables incorrectly or is this a bug??

Could be a bug. I 'll have to investigate...
Be patient!
This bug will be fixed soon...

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: C::B Global variables issue
« Reply #2 on: August 18, 2006, 08:39:36 pm »
Ok, I'll keep an eye on the nightlies...hoping to see a fix soon ;)

Thanks,
Nix

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #3 on: August 18, 2006, 09:02:04 pm »
Actually, me and Thomas have checked this and it's working as intended. Maybe if you posted a sample project file demonstrating this?
Be patient!
This bug will be fixed soon...

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: C::B Global variables issue
« Reply #4 on: August 19, 2006, 08:27:23 am »
I've attached a project with two build targets- Working and NotWorking - can you guess which is which :P
It is a minimal console project which refrences an include file that may end up being used by multiple projects, hence it's location outside of the project directory.

Just note that on first build and a complete rebuild both targets work, but when you make a change to CompileTest.h and press build&run or just build in the NotWorking build target the cnages are not reflected when the app runs (because the build reports that nothing needs to be done).

[attachment deleted by admin]

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #5 on: August 19, 2006, 08:50:52 am »
Tested your project and it works fine here.
What values have you used to setup the global variable? I 'm guessing you have not really understood what each of their options mean and how they resolve to paths.

Please read this article, if you haven't already...
Be patient!
This bug will be fixed soon...

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: C::B Global variables issue
« Reply #6 on: August 19, 2006, 03:49:06 pm »
I've only specified the parent directory in the 'base' field- in my case 'C:\My Projects'

I've read through the link you provided and can not find anything that I may have overlooked.

I'll play around some more and see if there's anything else amiss.

Thanks for time and all your help,
Nix

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: C::B Global variables issue
« Reply #7 on: August 19, 2006, 03:58:46 pm »
I think I may have identified the problem...

The problem only seems to manifest when the path contains a space (eg. 'C:\My Projects')

When I use paths without spaces everything is 100%

Hope it helps,
Nix

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #8 on: August 19, 2006, 06:48:35 pm »
I think I may have identified the problem...

The problem only seems to manifest when the path contains a space (eg. 'C:\My Projects')

When I use paths without spaces everything is 100%

Hope it helps,
Nix

This should prove to be valuable info, thanks.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #9 on: August 19, 2006, 10:54:22 pm »
The problem only seems to manifest when the path contains a space (eg. 'C:\My Projects')

Nope, that's not it: works for paths with spaces too...
Someone else who can verify this behaviour?
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: C::B Global variables issue
« Reply #10 on: August 20, 2006, 10:46:51 am »
Someone else who can verify this behaviour?
Here is someone (if I got that right). I've created a directory on the desktop (the path to the desktop has enough spaces in it). Then I extracted into this the archive. Thus I get this folder structure:
Code: [Select]
[DT]
 - CT
 |- CompileTest
 |- Include
I've setup the GV to point to [DT]\CT and the include property of this variable to point to [DT]\CT\Include. Then when I change something in the header file "CompileTest.h" and press "Build" (not Re-Build!) the first target (the working one) re-compiles but the second doesn't (after I changed again and again something in the header file). Is this supposed to be the bug? If so, what to do from here?
BTW: If I put all those files in a directory without spaces it works - so indeed it might be related to that...?!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #11 on: August 20, 2006, 11:52:27 am »
OK, I managed to reproduce it. Stay tuned...
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: C::B Global variables issue
« Reply #12 on: August 20, 2006, 12:08:11 pm »
Fixed.

Quote
I've setup the GV to point to [DT]\CT and the include property of this variable to point to [DT]\CT\Include.

Morten, btw you don't have to set the include property if it's {global_var}\include. That's the default anyway. You only have to set it if it points to another dir...
Be patient!
This bug will be fixed soon...

Offline nix_BB

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: C::B Global variables issue
« Reply #13 on: August 20, 2006, 12:17:24 pm »
 :D
Fantastic - Thanks alot guys - I thought I was going loopy!

Excellent support as usual.

-Nix

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: C::B Global variables issue
« Reply #14 on: August 20, 2006, 07:51:50 pm »
Morten, btw you don't have to set the include property if it's {global_var}\include. That's the default anyway. You only have to set it if it points to another dir...
Thanks - but I knew already. It was just my last setting to reproduce this issue, because I had a different directory structure before. Anyway: In former times this was written as a lable (hint) on top of these textboxes...
Thomas: Do you think it's worth mentioning these default on the GCV dialog?! Because this is not necessarily obvious.
With regards, Morten.
Edit: Uh - just know I saw you've fixed this already... fast as usual! Thanks! :P
« Last Edit: August 20, 2006, 07:53:44 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ