Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 C++ Class declaration using macro

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Cellule Posted - Dec 19 2016 : 4:31:22 PM
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.



2   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Dec 23 2016 : 6:58:14 PM
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
accord Posted - Dec 20 2016 : 7:19:03 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000