Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Auto Include path

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Mr11 Posted - Jan 25 2012 : 4:20:13 PM
I am trying to figure out how to control the path that the Auto Include functionality adds for header files. In my case I just want

#include <file.hxx>

or in some cases

#include <myPath/file.hxx>

depending on where the file resides (because our compiler will not work otherwise). I saw a way to edit the registry to have it no use shortest relative path but I don't think this solves my problem. Is there a way to dictate what this path should be?

Thanks in advance.
11   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 30 2012 : 5:15:16 PM
This makes sense. Since VA is looking to add the the new #include statement at the bottom of the list of #include statements, simply adding one setting, to say "add the new entry above this" will work, since the new line will still be as far down the list as possible. This also keeps things simple. If you have a rule for "below foo.h" and "above bar.h" then you will have problems if "bar.h" is above "foo.h".

I have put in a feature request for this, to see what our developers make of this:

case=64365
mertkew Posted - Jan 30 2012 : 09:25:57 AM
I like the idee to be able to control the position of the auto generated #include <>.
In our project we have an #include , which must be the last #include. Currenty I have to jump to the top of the file and sort the #includes after using the (very handy) "Auto Include" feature.

Alphabetical sort for all #includes is not allways possible, since there can be precompiled headers like StdAfx.h which must be included first.

It could work for the most cases if one could configure a list of #includes which must be left before the auto generated #include and a list of #includes which must be left after the auto generated #include.

e.g.
before list: MyFirst.h
auto generated includes go here, optionally alphabetically sorted
after list: MyLast.h

If one finds an unclear situation where the MyLast.h is included before the MyFirst.h, one could fall back to the current behaviour.
feline Posted - Jan 27 2012 : 8:30:39 PM
I am glad you have this fixed now, and I hope that Add Include is working well for you.

Unfortunately no, you cannot control where in the list of #include statements the new #include line goes, but you can always get VA to sort the #include lines after you have run Add Include:

http://www.wholetomato.com/products/features/sort.asp
Mr11 Posted - Jan 27 2012 : 6:25:46 PM
I fixed the issue now. Basically it was adding the path from my include directories to the file (duh). The include directories that I used were much to low, I talked to some people and I now have my project set up properly.

One last thing though, do you know if there is a setting that controls WHERE the include goes? As of right now it goes at the end of all of the includes, but I would like it to put it in there alphabetically.

Thanks for your help.
feline Posted - Jan 27 2012 : 3:08:23 PM
VA assumes that the solution it sees compiles, and it bases its actions on this. Since you have your own compiler, are you able to modify the Solution settings in the IDE, specifically the C++ additional include directories, to help VA generate the desired result?

Or is your compiler reading and respecting these IDE settings?
Mr11 Posted - Jan 27 2012 : 2:58:38 PM
We have our own compiler so I am not sure exactly how it works with relation to visual studio and its project setup but in the end what compiles is:

#include <file.hxx>

That's why I want to be in control of what is added when I do an include. There are some cases where I actually need to add a relative path, but it is for very specific types of class headers. In those cases I would like to add the correct path. I guess the ideal solution is to allow me to modify the include using regular expressions, via some code that is added to VA (similiar to how we can add our own snippets).
feline Posted - Jan 27 2012 : 11:26:21 AM
It depends on what compiles. If your C++ directories are just set to:

C:\\mySource

and you want the compiler to find the file:

C:\\mySource\\libraryA\\libA.h

then you will need the statement:

#include "libraryA\\libA.h"

otherwise the code will not compile. This is the statement that VA should be adding.

If you change the #include statement VA added to:

#include <file.hxx>

does your code still compile?
Mr11 Posted - Jan 26 2012 : 2:12:50 PM
I did try that but it didn't seem to change things. Also, that post states that the default is to make it shorter but I want it even shorter so I don't see how what is posted there will help me. Perhaps I did my C++ directories incorrectly because I just specified the main folder which has all of the source directories underneath it in child folders. So for example:

C:\\mySource

the contents of that folder are like
C:\\mySource\\libraryA
C:\\mySource\\libraryB
C:\\mySource\\libraryC

When I specified my C++ directories I just added C:\\mySource so that it would find all of the source in all of the sub-directories. Is this not the correct way to do it?
feline Posted - Jan 26 2012 : 12:27:17 PM
Have you changed the registry key AddIncludePreferShortestRelativePath as described here?

http://docs.wholetomato.com?W336

VA will normally use a #include line like this if the directory the header file is in is not listed as one of the directories the IDE should search. Is this directory set as an additional include directory somehow? If so, where and how have you set this?
Mr11 Posted - Jan 26 2012 : 09:58:31 AM
VA is adding the path to the file rather than just the file name. So for instance it adds:

#include <source/libraryName/subDirectory/file.hxx>

but all I want is:

#include <file.hxx>
feline Posted - Jan 25 2012 : 6:23:19 PM
When you trigger Add Include, what is VA adding? I assume from your post that what VA is adding is not compiling, so we need to work out why. VA should be aware of the additional include directories you have set, and respect these.

Are you compiling with the IDE, or are you using a different compiler? If the IDE is not configured for your solution to compile, then VA won't know what settings are required for your code to compile.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000