I get the following error trying to run C++ project in VS
My main.cpp (ATM machine.cpp)
#include <iostream>
#include <fstream>
#include <string>
#include "Account.h"
using namespace std;
class options
{
private:
char user_chose;
int id;
int pass;
public:
void login()
{
// Get credentials
cout << "Please enter your user id: ";
cin >> id;
cout << "Please enter your password: ";
cin >> pass;
}
void quit()
{
cout << "quiting...";
}
void IntroMenu()
{
cout << "Please select an option from the menu below :" << endl;
cout << "l -> Login" << endl;
cout << "c -> Create New Account" << endl;
cout << "q -> Quit" << endl;
cout << "> ";
cin >> user_chose;
switch (user_chose)
{
case ('l'):
case ('L'):
login();
break;
case ('c'):
case ('C'):
Account i;
i.createAccount();
break;
case ('q'):
case ('Q'):
quit();
break;
default:
{
cout << "\n***Invalid option***\n" << endl;
IntroMenu(); //Recall function
}
};
};
};
int main()
{
cout << "Hi!Welcome to the ATM Machine!" << endl;
options start;
start.IntroMenu();
return 0;
}
My header (Account.h)
#ifndef ACCOUNT_H_INCLUDED
#define ACCOUNT_H_INCLUDED
class Account
{
public:
void createAccount();
};
#endif
(Account.cpp)
#include "Account.h"
using namespace std;
Account::createAccount();
void Account::createAccount()
{
//Save account on database(txt file)
cout << "\nAccount created successfully\n" << endl;
}
Error 1
LNK2019 unresolved external symbol "public: void __thiscall Account::createAccount(void)" (?createAccount@Account@@QAEXXZ) referenced in function "public: void __thiscall options::IntroMenu(void)" (?IntroMenu@options@@QAEXXZ)
Error 2
LNK1120 1 unresolved externals
Thanks in advance!