Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VAX confused by include file location

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
pwc Posted - Jan 31 2008 : 1:59:50 PM
We have multiple stdafx.h files in our solution. They are, of course, in different directories and organized by the project that uses them. When I have a #include "stdafx.h" at the top of a cpp file, VAX usually points to the wrong copy of the file. Visual studio, however, gets it right when I rt-click on the file and choose 'Open Document "stdafx.h"'

Is this a known issue or should I try to put together a test case? I suspect it will require a solution with multiple projects and include paths.

I'm using 1626 with VC9.

Thanks
24   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 15 2011 : 12:01:12 PM
If you place the caret into the file name for the newly added #include file name, and look at the path shown in VA's definition field (normally at the top of the editor) does it show the correct path for the required file?

Does alt-g take you to the correct version of the header file?

I am wondering if VA has found the wrong file, or if the problem is just the relative path used to get to the file.
cha Posted - Apr 14 2011 : 9:22:48 PM
I experience the similar problem with 'Add include "someFile.h"' feature (if you try to use an undeclared symbol in the code and click on the dropdown option). Very often when there are many projects in a solution with the same include file (it may not be stdafx, but another file) VA confuses and adds incorrect include file. You may end up with #include "..\\AnotherProject\\someFile.h" line instead of #include "someFile.h".
feline Posted - Apr 09 2011 : 6:14:27 PM
Are you using VS2010? The screen shots look like you are. If so the underlining is coming from the IDE, not from VA. So if the main problem you are seeing is unwanted underlining in C++ code, then we need to look at your IDE settings, since this has nothing to do with VA.

Have you tried adding "../" to your projects C++ additional include directories? It looks like this should help the IDE find the stdafx.h file more easily.
day Posted - Apr 08 2011 : 3:48:17 PM
quote:
When you go into one of these problem "stdafx.h" files, is VA active?

Yes, VA is active.

quote:
Is it colouring the code correctly?

Yes! But, some definitions are underlined, as their definitions are located in other files connected via stdafx.h

quote:
Is it showing the context and definition fields?

Yes, and the definition field shows the correct path to stdafx.h when I set cursor on
#include "stdafx.h"


quote:
Are these stdafx.h files shown in VA's Open File In Solution dialog (Alt-Shift-O) ?

Yes it is.
quote:
If VA knows about the files then it should be able to find definitions in them.

Yes.

Some comments:
1. Only one "stdafx.h" file for whole project
2. cpp-file in sub dir "devs"
3. project build/rebuild has no location or definitions error.
4. If I add #include "../stdafx.h" (see pic.) VA find all definition.

You can see, if I set cursor on line 2 (#include "../stdafx.h") and on line 1 (#include "stdafx.h")
VA show equal path in definition fields!






feline Posted - Apr 08 2011 : 3:02:59 PM
When you go into one of these problem "stdafx.h" files, is VA active? Is it colouring the code correctly? Is it showing the context and definition fields?

Are these stdafx.h files shown in VA's Open File In Solution dialog (Alt-Shift-O) ? If VA knows about the files then it should be able to find definitions in them.
day Posted - Apr 08 2011 : 01:59:49 AM
Hello. I have some problem in dll project.
Source file in subdir include stdafx.h file...
VA can't find it (definitions in it), but path in the definition field are correct and alt+g too.

Using of ".\\" as an additional include directory for the dll project solve that problem, but maybe there is another problem's solution?

thank you
feline Posted - Feb 04 2008 : 2:55:07 PM
Interesting, I have to remove the additional include directories for both modes in both projects before VA starts showing me the correct path for this file.

I have put a note on the case about this.

For now the work around is to use the IDE's command to jump to these stdafx.h files.
pwc Posted - Feb 04 2008 : 2:09:45 PM
I removed any additional include directories from the main_exe, left the entry "./" for the dll1 project. I did this for both debug and release. This will still allow the incorrect behavior. Removing any additional include directories from the dll1 project seems to make it start working.
feline Posted - Feb 04 2008 : 1:56:35 PM
That works for you? I tried deleting all additional include directories for both projects, and I am still seeing the same problem.

Did you delete the directories just from the dll1 project?
Did you do this in both Release and Debug mode?

I am wondering what you are doing differently to me.

case=12270
pwc Posted - Feb 04 2008 : 1:39:55 PM
It seems it is the use of ".\\" as an additional include directory for the dll project. It's strange that this affects how the main exe project interprets where to find an include file.
pwc Posted - Feb 04 2008 : 1:36:13 PM
I just noticed that if you remove the additional include directories (project properties, C/C++, General, "Additional Include Directories"), the problem goes away.
feline Posted - Feb 04 2008 : 1:30:31 PM
I have the files and I am seeing the same problem. Thank you for this. Now I just need to figure out why VA is confused.
pwc Posted - Feb 04 2008 : 1:07:21 PM
Ok, I just sent it off.
feline Posted - Feb 04 2008 : 1:02:16 PM
You can submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up. So long as you select tech support this goes directly to me.

Deleting the NCB file and debug / release directories is normally a good idea, before you zip up the solution. Normally none of these files is required, and they can be quite large.
pwc Posted - Feb 04 2008 : 11:33:17 AM
I believe I have a reproducible solution. Is there a way to upload to a private area?
feline Posted - Feb 01 2008 : 2:17:58 PM
Thank you, any help you can provide in pinning down the problem will be much appreciated.
pwc Posted - Feb 01 2008 : 1:21:27 PM
Your solution works fine for me. I'll try to pare down my solution to find the root cause.
feline Posted - Feb 01 2008 : 11:44:40 AM
I have just created a simple test project here. The solution contains 5 projects, all of which have a stdafx.h file, and VA is having no problems:

http://forum.wholetomato.com/colin/forumimages/toic_7220_duplicate_file_test.zip

Can you download this VS2008 solution please and see if it works the same for you?

Something is obviously really confusing VA on your system. If this was just random then I would expect VA to get it right some of the time, but it does not sound like it is.
pwc Posted - Feb 01 2008 : 10:12:05 AM
Most, if not all. I didn't test all 2000 or so cpp files ;)

They are all supposed to have one stdafx.h per project. Some projects share a common stdafx.h.
feline Posted - Feb 01 2008 : 10:07:56 AM
This is good news, since this bit is working correctly.

Does VA get all of the stdafx.h files wrong? Most of them? Or only some of them?

Do you have one stdafx.h file per project in your solution? Or do you have several per project?
pwc Posted - Feb 01 2008 : 09:45:05 AM
Alt-g takes me to the file listed in the definition field. There is only one file listed in the definition field.
feline Posted - Feb 01 2008 : 08:12:02 AM
When you place the caret into one of the #include lines, into the file name "stdafx.h" does VA show you the path of the file alt-g takes you do in the definition field?

Or does alt-g take you to a different file?

If you use the down arrow at the end of the definition field, how many path's are listed? Just one, or several?

I am expecting only one path, and that alt-g takes you to this path. If this is working it should make it a bit easier to study what is happening in your solution.
pwc Posted - Jan 31 2008 : 4:01:02 PM
Yes, all 37(!) of them are listed.
feline Posted - Jan 31 2008 : 3:55:51 PM
Depending on how complex your solution is there may be very little VA can do about this. Are all of the copies of stdafx.h listed on VA's Open Files dialog?

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