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
 Technical Support
 VAX confused by include file location
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pwc
Tomato Guru

138 Posts

Posted - Jan 31 2008 :  1:59:50 PM  Show Profile  Reply with Quote
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

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Jan 31 2008 :  3:55:51 PM  Show Profile  Reply with Quote
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?

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

pwc
Tomato Guru

138 Posts

Posted - Jan 31 2008 :  4:01:02 PM  Show Profile  Reply with Quote
Yes, all 37(!) of them are listed.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 01 2008 :  08:12:02 AM  Show Profile  Reply with Quote
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.

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

pwc
Tomato Guru

138 Posts

Posted - Feb 01 2008 :  09:45:05 AM  Show Profile  Reply with Quote
Alt-g takes me to the file listed in the definition field. There is only one file listed in the definition field.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 01 2008 :  10:07:56 AM  Show Profile  Reply with Quote
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?

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

pwc
Tomato Guru

138 Posts

Posted - Feb 01 2008 :  10:12:05 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 01 2008 :  11:44:40 AM  Show Profile  Reply with Quote
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.

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

pwc
Tomato Guru

138 Posts

Posted - Feb 01 2008 :  1:21:27 PM  Show Profile  Reply with Quote
Your solution works fine for me. I'll try to pare down my solution to find the root cause.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 01 2008 :  2:17:58 PM  Show Profile  Reply with Quote
Thank you, any help you can provide in pinning down the problem will be much appreciated.

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

pwc
Tomato Guru

138 Posts

Posted - Feb 04 2008 :  11:33:17 AM  Show Profile  Reply with Quote
I believe I have a reproducible solution. Is there a way to upload to a private area?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 04 2008 :  1:02:16 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness

Edited by - feline on Feb 04 2008 1:03:02 PM
Go to Top of Page

pwc
Tomato Guru

138 Posts

Posted - Feb 04 2008 :  1:07:21 PM  Show Profile  Reply with Quote
Ok, I just sent it off.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 04 2008 :  1:30:31 PM  Show Profile  Reply with Quote
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.

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

pwc
Tomato Guru

138 Posts

Posted - Feb 04 2008 :  1:36:13 PM  Show Profile  Reply with Quote
I just noticed that if you remove the additional include directories (project properties, C/C++, General, "Additional Include Directories"), the problem goes away.
Go to Top of Page

pwc
Tomato Guru

138 Posts

Posted - Feb 04 2008 :  1:39:55 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 04 2008 :  1:56:35 PM  Show Profile  Reply with Quote
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

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

pwc
Tomato Guru

138 Posts

Posted - Feb 04 2008 :  2:09:45 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Feb 04 2008 :  2:55:07 PM  Show Profile  Reply with Quote
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.

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

day
New Member

2 Posts

Posted - Apr 08 2011 :  01:59:49 AM  Show Profile  Reply with Quote
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
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 08 2011 :  3:02:59 PM  Show Profile  Reply with Quote
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.

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

day
New Member

2 Posts

Posted - Apr 08 2011 :  3:48:17 PM  Show Profile  Reply with Quote
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!






Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 09 2011 :  6:14:27 PM  Show Profile  Reply with Quote
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.

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

cha
New Member

Australia
5 Posts

Posted - Apr 14 2011 :  9:22:48 PM  Show Profile  Reply with Quote
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".
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 15 2011 :  12:01:12 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
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