Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Add Include on files in the same folder

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

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

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
jbartley Posted - Mar 05 2015 : 2:29:43 PM
When I do an Add Include on a file in the same folder as the cpp file, I do not get any path information in the include.

I'm in foo.cpp, I highlight the foo class and choose Add Include.
Resulting include looks like
#include "foo.h"

What I want is for the include to include the full project path to foo.h, e.g.:
#include "folder/foo/foo.h"

I am already setting the AddIncludePreferShortestRelativePath registry value to 0 so that I do not get ".." relative paths. How can I also force Add Include to use full paths for files in the same folder?
6   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Sep 24 2018 : 2:31:04 PM
case=33851 is implemented in build 2291 -- see Add Include path on the Code Generation page of the VA Options dlg.
feline Posted - May 28 2015 : 12:43:22 AM
I have put a note on the case about your interest in this, but this is not currently a high priority, so I am not sure if or when we will look at this.

Are you aware that if you place the caret into the filename on the #include line VA shows you the full path of the file in the Definition field, normally visible at the top of the editor window. You can copy and paste the full path from here, or just a part of it, if that helps you to edit the #include statement.
dbarrie Posted - May 27 2015 : 7:05:54 PM
I would like to cast my vote for the inclusion of this feature as well! I just spent 20 minutes trying to figure out why the AddIncludePreferShortestRelativePath setting wasn't working, only to realize I was testing it on a symbol that was defined in a header file in the same directory as the source file I was testing with! While I'm glad to discover that the setting does indeed behave as expected, it'd still be great to have an option to make it behave the same way for headers in the same directory as the source file, just to keep things consistent across our (very large) codebase!
feline Posted - Mar 06 2015 : 1:33:55 PM
That makes sense. I have added a note about this to the feature request, but unfortunately it is unlikely to happen any time soon.

For now you may find using a VA Snippet helps you to fill in the path information. You could use a snippet that inserts $FILE_PATH$, which will give you the path of the current file, which could then be trimmed down to give you the path information you want to add to the #include statement. The full list of VA Snippet reserved strings is here:

jbartley Posted - Mar 06 2015 : 12:19:14 PM
We would like to have consistency in our include statements across the codebase.
feline Posted - Mar 06 2015 : 12:15:49 PM
Unfortunately no, there is no current way to tell VA to do this. We are considering adding this, but its not currently a high priority:


Out of interest why do you want this? There is no need to add the path in this situation, the code compiles perfectly happily for me.

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