Apr 5, 2011 at 11:05am UTC
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
Apr 5, 2011 at 12:21pm UTC
Check your header guards ( if you have any )
Apr 5, 2011 at 9:09pm UTC
What are the header guards? This is all I have in the preprocessor directives.
Last edited on Apr 5, 2011 at 9:10pm UTC
Apr 5, 2011 at 9:11pm UTC
1 2 3 4
#ifndef MY_HEADER_GUARD
#define MY_HEADER_GUARD
/*Do some fun stuff*/
#endif //MY_HEADER_GUARD
Last edited on Apr 5, 2011 at 9:12pm UTC
Apr 5, 2011 at 9:14pm UTC
I don't have any header guards. Where should I put them? The only thing that I cannot do is modify the ass1.cpp.
Apr 5, 2011 at 9:50pm UTC
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?
Apr 5, 2011 at 10:13pm UTC
Put header guards with unique identifiers in all of your headers