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 2
Oldest  Newest  Rating
0 Lachlan S · April 21, 2015
Any more help?
0 Lachlan S · April 17, 2015
Thanks for all the help btw, i would've given up by now :D
0 Lachlan S · April 17, 2015
Now it has the constructor, deconstructor or type conversion error. This is really inconsistent, it did this before (last page) and the next morning after no changes it went to those three errors. I am so confused right now.

Specifically here (happened last time as well),

People:: People(String x,Birthday bo)

the space between : and P was on purpose so it would show properly on site, not like that in actual prog.
//here is full page

#include "People.h"
#include "Birthday.h"
using namespace std;

People:: People(String x,Birthday bo)
: name(x), dataOfBirth(bo)

void People::printInfo(){
+1 Brian Reed · April 16, 2015

Sorry to here that did not work out. OK, lets start working the problem step by step.

So, to be clear, you are getting the same error messages as the ones you posted last time?

If so, that indicates to me that (since the error is in the main.cpp and refers to a class) the compiler can't find any reference to one of the other classes or both.

So, if your code is exactly the same and I ran it fine (after adding the missing #include), then the problem must be with the compilers connection to the other classes (because the error occurs while checking in main.cpp).

So, I have to ask, did you create a new project from scratch, then create new classes, or did you erase over the existing class files by pasting in the new code?

When the compiler hits an error its stops with a red square at the point of the error.
Post the code that is on that line (as this might not be the same line for me).
Then the error message for that line found in the "Biuld messages" Tab.

You'll get there, this is just a hickup;)


Things to check for when creating a new project:
Check compiler is "GNU GCC Compiler"
Things to check for when creating a new class:
Check that the "Has destructor" checkbox is Unchecked.
+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.
+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.
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.

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 Lachlan S · April 14, 2015
Its the github code, exactly the  same 

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.



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

Bucky Roberts Administrator