+ 1
i am getting a redefinition error when i write exactly this code.Why?
redefinition class error
24 Answers
+ 3
which programming language
+ 3
post the code
+ 2
Nurullah Kuş thats the include guard i was talking about, it prevents stuff from being included multiple times in indirect ways and therefore prevents redefinition errors
+ 1
Nurullah Kuş seems to work
+ 1
works for me
+ 1
did you use include guards?
+ 1
for your header files? or what header files did you make?
+ 1
can you post the content of each file?or post a screenshot somwhere and link it
+ 1
and you included the one for birthday in the one for person and included both in the main file?
+ 1
Nurullah Kuş there don‘t seem to be include guards, https://en.m.wikipedia.org/wiki/Include_guard
try adding them
you might also need to use:
using namespace std;
in Person.h
+ 1
this works for me: https://code.sololearn.com/c7Scwo6d56v7/?ref=app
0
https://code.sololearn.com/cOrP2BbgJj4r/?ref=app
0
i made two different header files and one cpp file in dev c++
0
wrote same code exactly to dev c++
0
yes i did
0
i did two different header file for Birthday and person
0
yes added both in main,gonna send the photo now
0
couldnt upload photo but i write exactly like this,check inside code i added header file like this
0
first one Birthday class second one Person class and last one main cpp,