Jan 10, 2014 at 1:03pm UTC
move line 11 to apple.cpp
Jan 10, 2014 at 2:06pm UTC
What error does it give you if you move line 11 to the cpp file?
What do you do to compile?
Jan 10, 2014 at 4:17pm UTC
the same error: multiple definition.
But I have actually fixed it by moving it to main.cpp
Jan 10, 2014 at 4:36pm UTC
It shouldn't matter what cpp file its in, as long as it's only in 1 cpp file.
You aren't #including cpp files in other cpp files, are you?
Jan 10, 2014 at 7:16pm UTC
Nope. You can see all in includes in my code above. I think the reason of that error is "apple.h" is included twice, once in apple.cpp and once in main.cpp. That's why it is redefined I guess.
Jan 10, 2014 at 7:26pm UTC
Yes.... having it in apple.h would have the redefined error for the reason you describe. That is correct.
However having it in apple.cpp should work just fine.