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
 C++ Class declaration using macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Cellule
New Member

USA
2 Posts

Posted - Dec 19 2016 :  4:31:22 PM  Show Profile  Reply with Quote
Visual Assist doesn't recogize classes if a c++ macro is used after the name.

I have the following code
#if defined(_MSC_VER) && !defined(__clang__)
// ms-specific keywords
#define _ABSTRACT abstract
#else
#define _ABSTRACT
#endif

class BaseClass _ABSTRACT
{
public:
    virtual void Method() = 0;
};

class ExtClass : public BaseClass
{
public:
    virtual void Method() {}
};

int main()
{
    ExtClass* a = new ExtClass();
    BaseClass* b = a;
    b->Method();
    return 0;
}


In this example, I can't use any autocomplete on b as BaseClass is not recognize as a class.
The coloring is also wrong as pictured below.



accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 20 2016 :  7:19:03 PM  Show Profile  Reply with Quote
I was able to reproduce the problem so I have put in a bug report for this:

case=102410

However, I was also able to find a workaround for you. If you rename macro "_ABSTRACT" to "FINAL", your BaseClass will be recognized.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 23 2016 :  6:58:14 PM  Show Profile  Reply with Quote
Another workaround is to create a va_stdafx.h in your solution's directory, and add the following content to it:

#define _ABSTRACT
// keep this comment to force EOL

Learn more about this here:
https://docs.wholetomato.com/default.asp?W302
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