I am lost and ran out of things to try that I know. I am trying to call a function in my main and I keep getting an undefined reference error (undefined reference to 'ParkingController::parkingMenuControl()').
How can I solve this issue? I have tried to rename that call to the class and even tried to rename the class and non of that has worked. Below is my code. Thank you in advance for help.
ParkingConrtol.h
#ifndef PARKINGCONTROL_H_INCLUDED
#define PARKINGCONTROL_H_INCLUDED
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
using namespace std;
class ParkingController
{
public:
void parkingMenuControl();
int parkingOption;
private:
};
#endif
parkingControlMain.cpp
#include "parkingControl.h"
using namespace std;
ParkingController parkingMenuMain;
int main(){
cout << "Welcome, Would you like to view our menu for parking?"<< endl;
cout << "Enter 1 to view menu or 0 to leave." << endl;
cin>>parkingMenuMain.parkingOption;
if (parkingMenuMain.parkingOption == 0)
{
exit(-1);
}
else if (parkingMenuMain.parkingOption == 1)
{
parkingMenuMain.parkingMenuControl();
}
}
and lastly here is my function parkingControl.cpp
#include "parkingControl.h"
/*
This module sets up the menu for the parking controller.
In here one can view the drawer with the money stored in
it and select a parking gate to enter from.
*/
using namespace std;
ParkingController parkingControlMenu;
void ParkingController::parkingMenuControl()
{
//Doing some function
}