VC++ missing type specifier - int assumed. Note: C

2019-07-09 04:24发布

问题:

This question already has an answer here:

  • “C4430: missing type specifier - int assumed” in a template function 1 answer

Following code compiled perfectly fine in VC++ 6.0, but when I opened the project in VS2005, I get this error:

BCGPopupMenu.h(100): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

What could be the problem ?

class BCGCONTROLBARDLLEXPORT CBCGPopupMenu : public CMiniFrameWnd
{
public:
    enum ANIMATION_TYPE
    {
        NO_ANIMATION,
        UNFOLD,
        SLIDE,
        FADE
    };

static SetAnimationType (CBCGPopupMenu::ANIMATION_TYPE type)
    {
        m_AnimationType = type; // this line gives error
    }
protected:
    static ANIMATION_TYPE m_AnimationType;

};

回答1:

static SetAnimationType (CBCGPopupMenu::ANIMATION_TYPE type)

there is no return value,you should do:

static void SetAnimationType (CBCGPopupMenu::ANIMATION_TYPE type)


回答2:

One possible reason is missing definitions. When you switch IDE, make sure you add every path you need into project setting.

See Tools >> Options >> Projects and Solutions >> VC++ Directories