help with tutorial 45, 46, 47

+1 Lachlan S · April 10, 2015
Can anyone help me with these? does anyone know cans and can'ts of classes and stuff. i have been getting nothing but errors, undefined references, all sorts. I can be more specific but does anyone know general rules.

Some Questions:

people::people ( can the latter be different to the first?)

Pretty much, how can I properly write tutorial 45,46,47 with objects that were named differently to their classes? 

Post a Reply


- page 1
Oldest  Newest  Rating
0 Lachlan S · April 13, 2015
Thanks, but with the tutorials, if I copy everything exactly from the github document, I still get an error (tutorial 46, 47) "||=== Build: Debug in check (compiler: GNU GCC Compiler) ===|
C:\Users\Home\Documents\Me\check\People.cpp|6|error: expected constructor, destructor, or type conversion before '(' token|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|" Do you know what is up with this?
0 Brian Reed · April 13, 2015
Hello Lachian,

The only thing I can think of from what I can glean about your compiler error is it might have something to do with the "Has destructor" checkbox you selected when creating the class (assuming you're using codeblocks). The totorial shows it needs to be unchecked. So, if it was me, I would just redo this as a new project as I don't know how to check for the selection after the class is created.

If you try making a new project and still can't resolve this issues, please provide the code you're trying to run. I am willing to work with you on this until your problem is resolved.

0 Lachlan S · April 14, 2015
Thanks for the help, i remember un-checking has destructor when i made the program, I made it yesterday to see if it actually run, and then I copied and pasted the entire git-hub document in their respective files just to see if it would work (i wanted to see if it was mine or the programs fault). but ill check it again today.
0 Lachlan S · April 14, 2015
Today when I run it exactly the same, I am getting three errors, which are exactly the ones i got when i followed the instructions, but it sort of makes me feel better that its not me haha. 

P.S. i am using codeblocks. Is visual studio good? i may start using it.
0 Lachlan S · April 14, 2015
errors are: 
C:\Users\Home\Documents\Me\check\main.o:main.cpp|| undefined reference to `Birthday::Birthday(int, int, int)'|
C:\Users\Home\Documents\Me\check\main.o:main.cpp|| undefined reference to `People::People(std::string, Birthday)'|
C:\Users\Home\Documents\Me\check\main.o:main.cpp|| undefined reference to `People::printInfo()'|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
0 Lachlan S · April 14, 2015
Its the github code, exactly the  same 

0 Brian Reed · April 15, 2015
Hello Lachian,

Thanks for posting the code it helps everyone to see and work the exact problem.
I've pasted it in Code Blocks and I'm getting the same errors you have.
I seem to remember running into this problem before when I first worked the tutorial last month.
I was sure I found the problem then, but I can remember or find reference to it :O
I must have been thinking, aah I've got this down pat, bad move! :angry:

Since then, I now take the time to create a new project for each important concept and comment on everything to explain what is going on with the code (its a great way to have a solid reference).
 I thought I had done so for this one, just can't find it :(

Just letting you know now that I will find the problem again and post it when I do. Unless someone beats me to the punch:)

I'm thinking it has something to do with the referencing between classes.
0 Brian Reed · April 15, 2015
Ok, I've solved the issue:D

#include "People.h" is missing from Birthday.cpp

I believe this is required because the Birthday object within "People.h" must be readily identifiable to the Birthday class.

+1 Lachlan S · April 15, 2015
Cool, thanks, ill try that later, its a bit late here. Anyway, I did think about that but it worked for bucky so I didn't think to change it.

Anyway, thanks.
+1 Lachlan S · April 16, 2015
Nope, same things occurring, hopefully bucky could come to help, but hes probably too busy making videos and moderating to respond. Thanks for the input, but i tried the #include change and it still didn't work.



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator