I am compiling a c++ program but i keep getting lines of code that make no sense and then at the bottom of it all it says "undefined reference to 'menu'". I have a .h file and a .cpp file, menu function is defined in my .h file, in my .cpp file i include my .h file at the top and this is also where I implement my menu function. And yes, I am compiling them at the same time
header file#include <iostream>
#include <cctype>
#include <fstream>
using namespace std;
/*
struct dog_park
{
char * name;
char * location;
char * description;
char * fence;
char * size;
};
*/
class parks
{
public:
struct dog_park
{
char * name;
char * location;
char * description;
char * fence;
char * size;
};
parks();
int menu();
bool display_all();
void add_park();
bool search_park();
~parks();
private:
dog_park * all_parks;
int length;
};
.cpp file
//implementation of functions
#include "cs162_parks.h"
parks::parks()
{
all_parks = new dog_park[length];
}
//allows for user to select what action to take
int parks::menu()
{
int choice = 0;
cout << "Welcome to the menu, your choices to choose from are: " << endl << endl;
cout << "1. Add a dog park to list" << endl;
cout << "2. Search for specific park by name" << endl;
cout << "3. Display all dog parks" << endl;
cout << "4. Quit" << endl << endl;
cout << "What menu selection do you choose? (1-4): ";
cin >> choice;
cin.ignore(100, '\n');
return choice;
}
parks::~parks()
{
if (all_parks)
delete [] all_parks;
}