I'm trying to send an Album object from main to a function in another .cpp file but I'm getting errors when compiling:
From main I create an Album object and then try to pass it to the menu function like so:
Model::Album album("TestAlbum");
View::Menu m;
m.startMenu(album);
My menu class:
#include "stdio.h"
#include "Menu.hpp"
#include "AlbumOps.hpp"
#include "Album.hpp"
#include <iostream>
using namespace std;
namespace View
{
void Menu::startMenu(Model::Album inAlbum) //compile errors happen here
{
int option = 1;
while (option!=5)
{
cout << "1. Add image to album\n";
cout << "2. Remove image from album\n";
cout << "3. List all images in album\n";
cout << "4. View image in album\n";
cout << "5. Quit\n";
//and so on
When I try to compile this, I get errors on the void Menu::startMenu(Model::Album inAlbum) line
'Model' has not been declared
Model is a namespace I use. I thought including the Album.hpp would fix this but it hasn't and I'm at a loss for how to fix this.
Edit: Menu is a class, here is my Menu.hpp:
#ifndef MENU_H //"Header guard"
#define MENU_H
namespace View
{
class Menu
{
public:
void startMenu(Model::Album inAlbum);
};
}
#endif
And my Album.hpp:
#ifndef ALBUM_H
#define ALBUM_H
#include <string>
#include <vector>
#include "Image.hpp"
namespace Model{
class Album
{
private:
std::vector<Image*> imageList;
std::string albumName;
public:
Album(std::string);
/****Setters****/
void setAlbumName(std::string);
void addImage(Image);
/****Getters****/
Image getImage(int);
std::string getAlbumName();
int getListLength();
};
}
#endif
Album.hppor one of the other headers.