Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Can't find the errors in the code

Author
Message
Liopriwo
14
Years of Service
User Offline
Joined: 2nd Dec 2009
Location:
Posted: 8th Apr 2010 19:15
Hi,

I recently downloaded and installed Dark GDK and wanted to make a simple pong game, but I get some errors, which I can't fix.
I looked several times through the code but to me it looks just fine.

Here are the files (they're also attached)

ball.cpp


ball.h


main.cpp


paddle.cpp


paddle.h



I hope someone can help, because I'm really dispair of these eror messages.

Thank you in advance and sorry for the not very descriptive thread title.

Attachments

Login to view attachments
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 8th Apr 2010 20:55
What you have is a cyclic dependency, where two classes rely on each other, and only one can be defined at a time.

What you need to do is put a forward declaration where you include the other class:

ball.h


paddle.h


"A computer once beat me at chess, but it was no match for me at kick boxing."
Emo Philips
Liopriwo
14
Years of Service
User Offline
Joined: 2nd Dec 2009
Location:
Posted: 9th Apr 2010 02:13
Ahhh, I thought of something like this, but I didn't know how to solve it. I think your solution is something similar to a function prototyp, isn't it?

But thank you very much Bran flakes91093, 'cause without your help this thing would have driven me crazy.

Login to post a reply

Server time is: 2024-10-02 03:32:07
Your offset time is: 2024-10-02 03:32:07