Author |
Topic |
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Jan 28 2011 : 03:10:44 AM
|
Hi,
What are the prerequisites for availability of this method in the refactoring menu? I am not able to "activate" that functions although I have a code with numerous classes derived from others with pure virtual methods. The code is C++ unmanaged under visual C++ 2003. I even tried simple dummy code with two classes and some abstract methods, but the "implement interface" is alway gray does not matter where I put the caret or mouse cursor.
I also tried that in VC++ 2008 with the same result. |
Edited by - Michal Puczynski on Jan 28 2011 03:39:23 AM |
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Jan 28 2011 : 11:23:21 AM
|
In the following example, the command should be available on both Derived and Base (only in the declaration of Derived):
class Derived : public Base { }
If that doesn't help, then we'll need to see the declaration of Base.
|
|
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Jan 31 2011 : 08:51:27 AM
|
OK, so I wrote:
class CClassBase { CClassBase(); virtual ~CClassBase();
virtual test_method(int y) = 0; };
class CClassDerived: public CClassBase {
};
and trying to with right-click menu on CClassDerived, CClassBase and the "Implement interface" is not available either. What am I doing wrong?
PS. Maybe that is worth mentioning: The above code I've put into other header that belongs to a huge project....
Then, I made experiment with simple just opened project (MFC console application), and IT WORKS!
So, it seems problem is somewhere within symbol database generated by VA. Clearing it does not help....
|
Edited by - Michal Puczynski on Jan 31 2011 09:01:11 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jan 31 2011 : 11:26:39 AM
|
At a guess there is something in the file confusing VA's parser, or VA recognises these class names from somewhere else in your solution, and the duplicate class names are causing confusion.
Can you try this code instead please:
class CFeline9972Base
{
CFeline9972Base();
virtual ~CFeline9972Base();
virtual test_method(int y) = 0;
};
class CFeline9972Derived: public CFeline9972Base
{
};
these should be unique class names in your solution. If you still get the problem can you open a new, empty .h file in the main solution and run the test there?
I am wondering if some of the code in your existing files is a factor, somehow. |
zen is the art of being at one with the two'ness |
|
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Jan 31 2011 : 12:02:32 PM
|
The result is exactly the same as in my test.
What can be wrong with my code if compiler is not complaining? Do you have an idea how to find that? |
Edited by - Michal Puczynski on Feb 01 2011 03:15:10 AM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Feb 01 2011 : 11:58:07 AM
|
Does your CClassBase / CClassDerived code work in another file within your solution? That is, is the problem with a specific set of files within your solution? |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Feb 01 2011 : 2:26:32 PM
|
Do you mean that implement interface is Not offered on my sample code in your main solution?
Here is a second test, I have added a second virtual function, but this time it has been implemented:
class CFeline9972Base
{
CFeline9972Base();
virtual ~CFeline9972Base();
virtual void test_method(int y) = 0;
virtual void actually_implemented(int z) = 0;
};
class CFeline9972Derived: public CFeline9972Base
{
virtual void actually_implemented( int z ) { }
};
Is VA's Find References offered on "actually_implemented" in either class? If it is offered, does it find both references, so is VA scanning the parent or child class correctly?
Since the code is compiling, I am guessing this is either something inside a #if 0 #endif block, or something to do with macro's that is confusing our parser. Normally though these problems are file specific, sometimes triggered by a #include line, so a blank file would not have these problems. |
zen is the art of being at one with the two'ness |
|
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Feb 02 2011 : 04:13:57 AM
|
Hi, I pasted your code into my header. At first shot the symbols were unrecognized, all but test_method. After a while ~15 secs, the screen refreshed and all become recognized. The VA find references is offered on all symbols around that code including implemented and not implemented methods and class names. The implement interface is not offered at all. Then I pasted that code into newly created project. The implement interface was immediately available. |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Feb 02 2011 : 1:37:43 PM
|
15 seconds is a long time! How many lines are there in this code file? I am wondering why parsing is taking so long.
If you open a new, blank .h file in your solution, and add my test code to it, is implement interface available? |
zen is the art of being at one with the two'ness |
|
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Feb 03 2011 : 03:01:31 AM
|
Yes, as I wrote in my previous post, it is available immediately.
The particular header I pasted the code into is not that big, it has 550 lines, the corresponding cpp file has 5000 lines. Both however include quite a lot from DirectX SDK. After precompiler, the output code has 500k lines (6MB).
|
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Feb 03 2011 : 1:13:27 PM
|
Are the DirectX SDK header files in one of VA's stable include directories?
If you have turned on:
VA Options -> Advanced -> Fonts and Colors -> Stable symbols in Italic
are symbols from this SDK shown in italics?
http://www.wholetomato.com/products/features/directories.asp
VA should only rarely re-parse header files in the stable include directories, so assuming the SDK is in the stable includes, I am wondering if the IDE's intellisense parser could be a factor here.
Can you try closing the IDE and adding a pair of zero length read only .NCB files, as described here:
http://docs.wholetomato.com?W133
this should disable the IDE's intellisense parser, removing one variable. |
zen is the art of being at one with the two'ness |
|
|
Michal Puczynski
Ketchup Master
Poland
85 Posts |
Posted - Feb 04 2011 : 05:23:14 AM
|
It seems more problematic. I have all the include folders under "include files". The solution I am working on shares the code. As a result almost all symbols are in italic. The header I am putting the code into lies under one of those folders. From what I understand, I am modifying "rarely changing code". But, rebuilding the symbols database does not help also "reparse current file" is not helping.
Does it make sense according to what I am experiencing? I have feacp.dll removed, so intellisense shall not be the factor. |
Edited by - Michal Puczynski on Feb 04 2011 05:33:20 AM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Feb 04 2011 : 3:51:20 PM
|
Yes, that makes sense. Many refactor commands are not available on code in system directories.
If you can't use project settings for "Additional Include Directories", then you might have some success using a Custom platform in the VA Options dialog (Projects | C/C++ Directories). Put crt/mfc directories (if applicable) in the "Stable include files" list and then your shared source in the "Other include files" list.
|
|
|
|
Topic |
|