2

Does anyone have any ideas on how to fix this? I've looked online and changed settings on my visual C++, but it still doesn't work.

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; } 

It gives me:

Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall customer::CustomerMenu(void)" (?CustomerMenu@customer@@QAEHXZ) referenced in function _main 1>Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall employee::EmployeeMenu(void)" (?EmployeeMenu@employee@@QAEHXZ) referenced in function _main 1>Store.obj : error LNK2019: unresolved external symbol "public: int __thiscall store::MainMenu(void)" (?MainMenu@store@@QAEHXZ) referenced in function _main 
2
  • why do you have a variable called main? Commented Jun 2, 2013 at 21:13
  • not to mention if (main = 1) will always be true. you mean ==. Commented Jun 2, 2013 at 21:15

3 Answers 3

4

You're implementing CustomerMenu() and EmployeeMenu() as normal functions, not class members. The implementaitons should be;

int customer::CustomerMenu() { ... int employee::EmployeeMenu() { ... 
Sign up to request clarification or add additional context in comments.

Comments

1

Your member function implementations need to be defined correctly. For example:

int CustomerMenu() 

Should be:

int customer::CustomerMenu(void) 

And so forth.

Comments

1
if(main = 1) { //^^should be ==, same as the one below c.EmployeeMenu(); } else if(main = 2) { b.CustomerMenu(); } 

Member functions should be defined with scope resolution operator:

int CustomerMenu() 

should be:

int Customer::ustomerMenu() 

Minor point:

class employee:store 

Here you used private inheritance, you really need to think about whether you need it or not.

3 Comments

(The OP is novice. Obviously he doesn't need private inheritance.) the syntax should be class employee : public store. but it sounds unlikely that an employee will inherit from store.
@Elazar I totally agree with you.
Thanks to both of you for your input. As Elazar stated I am a beginner.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.