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
 Can't do "Find References" for function defintions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

psherm85
New Member

7 Posts

Posted - Mar 30 2009 :  08:38:30 AM  Show Profile  Reply with Quote
Every time I'm in a cpp file and I try to "Find References" for a function defined in that file, I get the error "Please place caret on a symbol before doing find references". I always have the caret somewhere in the function name (between the "::" and the "(") when I do this. Interestingly, I tried rebuilding the symbol databases, restarting the IDE and waiting for the status bar "VA X: Parsing..." messages to disappear and it worked immediately after that; however, if I try to do it a second time after that, even in a different cpp file, I get the error message again. What could be wrong?

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Mar 30 2009 :  11:38:44 AM  Show Profile  Reply with Quote
Which IDE and version of VA are you using?

What does VA show in the context and definition fields when you place the caret into the function name in the cpp file? These are normally at the top of the editor window.

Does reparsing the current (cpp) file make any difference?

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

psherm85
New Member

7 Posts

Posted - Mar 30 2009 :  11:50:08 AM  Show Profile  Reply with Quote
My visual studio version is:
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP1

My visual assist X version is:
Version 10.5.1715.0 built 2009.01.25

The context field shows the name of the function and the definition field shows nothing. Also, the function name is underlined in red, but despite this the code compiles and links.

Reparsing just the current file does not make a difference


Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Mar 30 2009 :  12:26:08 PM  Show Profile  Reply with Quote
As a quick sanity check can you please change the colour:

VA Options -> Advanced -> Underlines -> Underline mistyped symbols using

to something other than red. This will prove if the function names are being underlined by VA or not.

If VA is underlining the function names then this is why Find References does not work. We need to find out why the underlining is happening.

Please note that VA does not do any underlining when you first open a file. You need to edit the file or reparse it before the underlining appears. This is by design.

Does upgrading to VA 1721 make any difference?

http://www.wholetomato.com/downloads/default.asp

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

psherm85
New Member

7 Posts

Posted - Apr 05 2009 :  12:13:30 AM  Show Profile  Reply with Quote
The function names are being underlined by VA (I did the sanity check) and unfortunately upgrading to VA 1721 doesn't help.

I think I have a few more clues as to what might be wrong, however, though unfortunately it's still hit or miss. Our framework consists of classes that are generated by a code generator and added to a namespace we call "Gen". We then inherit from these generated classes to add specialized functionality, with the name of the inherited class being the same as the name of the generated class. The inherited class is not in any namespace. The problem occurs in the subclass's .cpp file (A.cpp), as shown in the following example:

=============================================================
//Gen/A.h
#ifndef _GEN_A_H
#define _GEN_A_H

namespace Gen
{
class A
{
public:
A() {};
void X(int a);
};
}

#endif

=============================================================
//Gen/A.cpp

#include "stdafx.h"
#include "Gen/A.h"

void A::X( int a )
{
int b = a;
}

=============================================================
#ifndef _A_H
#define _A_H

#include "Gen/A.h"

class A : public Gen::A
{
public:
A() {};
void fn();
};

#endif

=============================================================
//A.cpp

#include "stdafx.h"
#include "A.h"

void A::fn()
{
int x = 1;
}

=============================================================


"fn" in A.cpp is what's being underlined. However, I also notice that pressing "Alt+G" on "A" in A.cpp, takes me to Gen::A, rather than ::A. So if VAX determines that A represents Gen::A, that probably explains the underlining since Gen::A doesn't have a definition for fn. In fact, replacing "A::fn()" with "::A::fn()" in A.cpp removes the underline.

However, it still doesn't happen every single time. It seems that I have to edit a file before it happens, but even when I do edit it, it still sometimes doesn't underline. It may have something to do with minimizing visual studio for a few minutes and then coming back, but I'm not sure about this. I'll continue to be on the lookout and I'll let you know if I spot any more patterns, but I hope this gives you some ideas about what the problem might be.

Go to Top of Page

psherm85
New Member

7 Posts

Posted - Apr 05 2009 :  12:27:52 AM  Show Profile  Reply with Quote
***Small correction to the above:

The contents of "//Gen/A.cpp" should be enclosed in namespace Gen {...}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 06 2009 :  4:06:15 PM  Show Profile  Reply with Quote
I have set up a simple test from your sample code. Can you try downloading and opening this VS2005 console project please, and see what results you get:

http://forum.wholetomato.com/colin/forumimages/8641_dup_class_name.zip

I have used slightly more unique names than "A", but the result should be the same. I am not seeing any sign of underlining or other problems.

I would not be surprised to see VA get a little confused, and return the wrong class members sometimes, but I would not expect the function names to be underlined like you are seeing.

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