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
 1543: Find references and stdafx.h
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 09 2007 :  4:43:59 PM  Show Profile  Reply with Quote
VAX 1543, VS2005, WinXP

Find references is not allways works properly in files included in stdafx.h

Steps to reproduce:

1. Create a new win32 project in VS2005
2. Create cOther.h file into the project with this content:

#ifndef _OTHER_H
#define _OTHER_H

class cAdder {
int Apple;
};

class cOther {
public:
tArray <cAdder> Adders;
void Something(void);
};

#endif
---
3. Create cOther.cpp into the project with this content:

#include <stdafx.h>
#include "cOther.h"

void cOther::Something(void)
{
Adders.GetSize();
}
---
4. Create tArray.h into the project with this content:

#ifndef _TARRAY_H
#define _TARRAY_H

template <class T> class tArray {
public:
int GetSize(void)
{
return 0;
}
};

#endif
---
5. Go to GetSize() definition in tArray.h, and Do a Find References on it.

Only references in this file will appear.

In my project other references also appears but only from this file, and files which are NOT included in stdafx.h

If you go cOther.cpp and Do Find References on GetSize(), it can found itself (and any other references in this file if any). So symbol is recognised. Is something wrong with handling stdafx.h?

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jan 09 2007 :  5:53:34 PM  Show Profile  Reply with Quote
I am seeing the same effect here, but I don't see where the reference to "stdafx.h" comes from. It is not referenced in these instructions, and on the surface does not seem to be relevant to this problem.

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

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jan 09 2007 :  6:05:23 PM  Show Profile  Reply with Quote
Out of interest do you only see this problem with template classes?

case=4445

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

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 09 2007 :  6:30:47 PM  Show Profile  Reply with Quote
Sorry, I forgot a step beforde step 5:

- put to the end of stdafx.h

#include "tArray.h"
#include "cOther.h"
---
So cOther now "sees" the tempalate class "tArray", so Find References should work.

>do you only see this problem with template classes?
Yes, only templates are broken. These templates are included in stdafx.h

>I don't see where the reference to "stdafx.h" comes from
Template member function callings are found in cpp files which are NOT included in the stdafx.h. But I cannot reproduce this behavior in this test project so far.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 09 2007 :  6:45:48 PM  Show Profile  Reply with Quote
I found an exception from stdafx.h rule. So forget this theory...

Some references found in a few other files also. But no exact pattern so far. But my example is a good starting point for debugging, isn't it?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jan 10 2007 :  07:44:59 AM  Show Profile  Reply with Quote
Getting something to go wrong reliably is a very good starting point

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