T O P I C R E V I E W |
psherm85 |
Posted - Mar 30 2009 : 08:38:30 AM 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? |
6 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Apr 06 2009 : 4:06:15 PM 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. |
psherm85 |
Posted - Apr 05 2009 : 12:27:52 AM ***Small correction to the above:
The contents of "//Gen/A.cpp" should be enclosed in namespace Gen {...} |
psherm85 |
Posted - Apr 05 2009 : 12:13:30 AM 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.
|
feline |
Posted - Mar 30 2009 : 12:26:08 PM 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
|
psherm85 |
Posted - Mar 30 2009 : 11:50:08 AM 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
|
feline |
Posted - Mar 30 2009 : 11:38:44 AM 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? |
|
|