Есть ли у кого-нибудь идеи о том, как исправить это? Я посмотрел онлайн и изменил настройки на моем визуальном C++, но он все еще не работает.ошибка LNK2019: нерешенный внешний символ, на который ссылается функция _main visual C++
class store
{
public:
int MainMenu();
store();
private:
int main;
};
class customer:store
{
public:
int CustomerMenu();
customer();
private:
int cmenu;
};
class employee:store
{
public:
int EmployeeMenu();
employee();
private:
int emenu;
};
int main()
{
int main;
store a;
customer b;
employee c;
a.MainMenu();
if(main = 1)
{
c.EmployeeMenu();
}
else if(main = 2)
{
b.CustomerMenu();
}
else
{
exit(EXIT_SUCCESS);
}
}
int MainMenu()
{
int main;
cout << "Choose an option: " << endl;
cout << " 1. Administration menu" << endl;
cout << " 2. Customer menu" << endl;
cout << " 3. Exit the program" << endl;
cin >> main;
return main;
}
int CustomerMenu()
{
int cmenu;
cout << " 1. Search Video" << endl;
cout << " 2. View Video Titles" << endl;
cout << " 3. Rent Video" << endl;
cout << " 4. Exit to the Main Menu" << endl;
cout << " 5. Exit the program" << endl;
cin >> cmenu;
return cmenu;
}
int EmployeeMenu()
{
int emenu;
cout << " 1. Store Information menu" << endl;
cout << " 2. Merchandise Information menu" << endl;
cout << " 3. Category Information menu" << endl;
cout << " 4. Customer Information menu" << endl;
cout << " 5. Employee Information menu" << endl;
cout << " 6. Rent a Video" << endl;
cout << " 7. Restock Video" << endl;
cout << " 8. Sales menu" << endl;
cout << " 9. Exit to Main Menu" << endl;
cout << " 10. Exit the program" << endl;
cin >> emenu;
return emenu;
}
store::store()
{
main = 0;
}
customer::customer()
{
cmenu = 0;
}
employee::employee()
{
emenu = 0;
}
Это дает мне:
Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall customer::CustomerMenu(void)" ([email protected]@@QAEHXZ) referenced in function _main
1>Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall employee::EmployeeMenu(void)" ([email protected]@@QAEHXZ) referenced in function _main
1>Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall store::MainMenu(void)" ([email protected]@@QAEHXZ) referenced in function _main
Почему у вас есть переменная, называемая 'main'? – Elazar
не говоря уже о 'if (main = 1)' всегда будет true. вы имеете в виду '=='. – Elazar