'Class' Type Redefinition

Hi Guys:

I am receiving the 'Class' Type Redefinition C2011 error on the Patient class but I haven't been able to figure out why the error is showing. Could you please help me with this one? Thanks.

Ass1.cpp
#include <iostream>
#include <iomanip>
#include "PatientAccount.h"
#include "Surgery.h"
#include "Pharmacy.h"
using namespace std;

PatientAccount.cpp
#include <iostream>
#include "PatientAccount.h"
using namespace std;

Pharmacy.cpp
# include <iostream>
# include "Pharmacy.h"

Surgery.cpp
# include <iostream>
# include "Surgery.h"

Surgery.h
#include "PatientAccount.h"

Pharmacy.h
#include "PatientAccount.h"

The only condition for this to work is that I cannot edit Ass1.cpp

Thanks in Advance,
MTA


Check your header guards ( if you have any )
What are the header guards? This is all I have in the preprocessor directives.
Last edited on
1
2
3
4
#ifndef MY_HEADER_GUARD
#define MY_HEADER_GUARD
/*Do some fun stuff*/
#endif //MY_HEADER_GUARD 
Last edited on
I don't have any header guards. Where should I put them? The only thing that I cannot do is modify the ass1.cpp.
Hi mta, the header guards should be located at the top of each header file (i.e. files with extension .h), with each guard being unique.

The only thing that I cannot do is modify the ass1.cpp.

I would assume that Ass1.h (if it exists) already has header guards so I wouldn't worry about it.

good luck!
Hi dangrr888:

Ass1.cpp doesn't include any header file. But I am still receiving the same problem. Any Ideas of what can be happening?
Put header guards with unique identifiers in all of your headers
Topic archived. No new replies allowed.