Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Add Include refactoring using absolut project path
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Luke1410
Senior Member

32 Posts

Posted - Sep 28 2009 :  09:24:45 AM  Show Profile  Reply with Quote
Hi,

Would it be possible to tell the "Add Include" feature to generate the include statements using paths relative to the project root?

One of our code conventions in use defines that all include statements must be specified relative to the project root in order to not run into problems when header files are being moved.

Example:
file structure:
C:\\demo\\main.h
C:\\demo\\package1\\foo.h
C:\\demo\\pacakge1\\bar.h

Using VAX "Add Include" feature to automatically include bar.h in foo.h results in the statement:
#include "bar.h"

However, we would prefer the include statement to be
#include "package/bar.h"

Quite convenient would be if VAX automatically guesses whether absolut or relative paths are to be used based on the already existing include statements in the header files as it does with guessing the correct path separator.

Regards,
Stefan

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 28 2009 :  4:01:08 PM  Show Profile  Reply with Quote
I see your motivation behind this, but detecting something like this can be quite ambiguous. Consider the following: we have 3 includes, and every one is a relative path and also, each of the headers are in a different directory, so the relative path is necessary. In a case like this, we cannot decide which method to choose. Anyway, I think that this code convention is a little "odd", but this is only my personal opinion.
Go to Top of Page

Luke1410
Senior Member

32 Posts

Posted - Oct 01 2009 :  5:16:29 PM  Show Profile  Reply with Quote
Well I won't argue with you about the usefulness of this particular code convention. Looking at our 3rd party libraries we have in use shows at least one which follows this include convention too, however (namely FCollada).

I understand that this feature might not be of a broad application around VAX users, so I understand that time would be better spent on other issues.
However, in our case it would be more than sufficient to get VAX to always add includes with paths relative to the project root (maybe setable via a registry entry). :-)

Edited by - Luke1410 on Oct 01 2009 5:20:03 PM
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 13 2009 :  4:43:15 PM  Show Profile  Reply with Quote
Have you specified the project root as an include directory or as an additional include directory? Is this the only include directory that you use? (in addition to the 3rd party includes)
I'm wondering how this feature would be implemented. May be suitable to add an option which will make VA to add includes relatively to one of the include directories without using ".." in the include path.
Would this approach be appropriate for you?

Edited by - accord on Oct 13 2009 4:46:21 PM
Go to Top of Page

Luke1410
Senior Member

32 Posts

Posted - Oct 13 2009 :  5:02:32 PM  Show Profile  Reply with Quote
Yes, we've added "." as the first include directory in the "compiler additional include directory"-setting. Beside 3rd party include directories, that's the only project include directory in the list.

As far as I can see ur suggested implementation might do the trick for us.
An alternative way could be to specify an optional root folder in the registry.
Assuming that root folder being set to: "C:\\project":
C:\\project\\foo.h
C:\\project\\dummy\\bar.h
C:\\project\\dummy\\bar2.h
->
foo.h:
#include "dummy/bar.h"
bar.h:
#include "foo.h" // i.e. not "../foo.h"
bar2.h:
#include "dummy/bar.h" // i.e. not "bar.h"

Edited by - Luke1410 on Oct 14 2009 07:43:07 AM
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 14 2009 :  5:20:46 PM  Show Profile  Reply with Quote
I have put in a feature request to see what the developers make of it:

case=33851

I suggested to
quote:
"add an option which will make VA to add includes relatively to one of the include directories without using ".." in the include path."
to generalize the problem and to ease the setup.
Go to Top of Page

thethirdhalf
Junior Member

16 Posts

Posted - Jul 13 2011 :  10:26:41 AM  Show Profile  Reply with Quote
I noticed that in the latest build (10.6.1850.0), it always includes relative paths in the add include option (it has done this for as long as I have used the option).

However, this couples the code to what should be a build system issue, which is indicative of a failure to properly configure the build. Relative and absolute paths to headers in code is really fragile. Our build system handles this seamlessly for us.

Is this option configurable? I haven't been able to find this out by searching. If I want to include 'Bar.h', I need it to show up as #include <Bar.h>, no matter where it is in the project.

Thanks.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jul 18 2011 :  1:14:05 PM  Show Profile  Reply with Quote
Apologies for the slow reply. There is a registry key setting for this, as explained in this FAQ entry:

http://docs.wholetomato.com?W338

If I understand correctly this should do what you want.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 24 2018 :  2:31:20 PM  Show Profile  Reply with Quote
case=33851 is implemented in build 2291 -- see Add Include path on the Code Generation page of the VA Options dlg.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000