C++ 如何在main()以外的函数中使用类?

C++ 如何在main()以外的函数中使用类?,c++,visual-studio-2015,C++,Visual Studio 2015,我不能像在main()中那样调用类并在此函数中使用它。代码有什么问题,我使用的是visual studio 2015社区,错误如下:- Error C2653 'CALL': is not a class or namespace Error C3861 'calling': identifier not found 代码如下: void menu() { int i, j, user; for (i = 1; i <= 5; i++)

我不能像在main()中那样调用类并在此函数中使用它。代码有什么问题,我使用的是visual studio 2015社区,错误如下:-

Error   C2653   'CALL': is not a class or namespace     
Error   C3861   'calling': identifier not found 
代码如下:

void menu()
{

    int i, j, user;
    for (i = 1; i <= 5; i++)
    {
        cout << "* *";
    }
    cout << "  WELCOME TO CRAZY MATH  ";
    for (i = 1; i <= 5; i++)
    {
        cout << "* *";
    }
    cout << "\n\nPlease choose an option...\n_______________________________________\n" << endl;
    cout << "press 1 for basic math calculator\npress 2 for TABLES\npress 3 for a random number" << endl;
    cout << "press 4 for matrix calculator\npress 5 for programmer's converter\n\npress 0 to exit\n" << endl;
    //various options provided to the user, more will be added soon...
    cin >> user; //gets input from the user
    CALL objk; // declared class //but cannot use it shows error
    objk.calling(user);
}

// here lies the class call

class CALL
{   
private:
    int user;

public:
    void calling(int user)    
    {
        if (user == 1) // for bas_cal
        {
            bas_math m1;
            m1.calc();
        }
        else if (user == 3) // random numbers
        {
            srand(time(0));
            cout << "__________________________________\n\nthe random number is: " << rand() % 21;
        }
        else if (user == 2) // tables
        {
            tables tab;
            tab.table();
        }
        else if (user == 4) //matrix
        {
            MATRIX mat;
            mat.matrix();
        }
        else if (user == 0) //exit
        {
            EXIT e;
            e.exi();
        }
    }
};
void菜单()
{
int i,j,用户;

对于(i=1;i必须先声明实体,然后才能使用它。通常,这是通过将类定义放入头文件来实现的,并且
\include
将此头文件放入要使用该类的任何源文件中。在使用它之前是否定义了
CALL
?@Igor Tandetnik应该定义它。声明可以是声明类型不完整,仅在少数情况下有效。文档可以提供帮助!在上面声明类的使用位置或在中声明类。