i have 2 classes in different namespaces and both of them needs to include same Image.h class but when i include at the same time i get an error. Here my classes:
FilterManager.h:
#ifndef FILTERMANAGER_H_
#define FILTERMANAGER_H_
#include "../Images/Image.h"
namespace Filter {
class FilterManager {
public:
Image* applyFilter(int filterType, PGMImage *pgmImage);
};
} /* namespace Filter */
#endif /* FILTERMANAGER_H_ */
Main Application class : This includes Images/Image.h and Filter/FilterManager.h at the same time and i get an error.
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#include "Images/Image.h"
#include "Filter/FilterManager.h"
using namespace std;
int main() {
//new typename ImageIO::ImageIO;
Images::Image *Image = NULL;
Filter::FilterManager::getInstance();
pgmImage = imageIO->readPGM("Resources/house.256.pgm");
return 0;
}
And Image.h class
#ifndef IMAGE_H_
#define IMAGE_H_
#include "Image.h"
namespace Images {
class Image {
public:
Image();
virtual ~Image();
private:
int** imatrix(int nrl,int nrh,int ncl,int nch);
};
} /* namespace Image */
#endif /* IMAGE_H_ */
Thanks for any help
You forgot the namespace.
I don’t see any #include “PGMImage.h”
Where is it? And what is PGMImage?
Why in Image.h there is an include to Image.h?