Random error occurences? [ NOT Solved]

Started by
11 comments, last by SirLuthor 19 years, 2 months ago
Quote:Original post by SirLuthor
Oh. my. god. I hate it when I do that... Such a simple mistake, I probably never would have found it, if not by pure chance of having encountered something sort of like this a while back, which I had forgotten about.

Apparently, the problem was this: In the shared header, Ascendancy.hpp, the ASC-EntryTask.hpp was included above the ASC-Task.hpp file, which would lead to the 'EntryTask' class inheriting from a class not even declared when EntryTask was declared..

Of course, simple beginner's mistake as it was, that was a very vexing experience.. And I still can't figure out why it borked all my curly braces [smile].... Cheers folks, and thanks for the input! Apparently, #include'ing in alphabetical order is not always the optimal setup :D


:)

To avoid this problem, you should #include "ASC-Task.hpp" in ASC-EntryTask.hpp. This costs nothing - well, maybe some compiler time, but I bet a difference of 20 milliseconds per file will not hurt you - and avoid this kind of errors.

One rule I always follow: if class B inherits from class A, then the declaration file of B includes the declaration file of A.

Regards,
Advertisement
Quote:Original post by Emmanuel Deloget
Quote:Original post by SirLuthor
Oh. my. god. I hate it when I do that... Such a simple mistake, I probably never would have found it, if not by pure chance of having encountered something sort of like this a while back, which I had forgotten about.

Apparently, the problem was this: In the shared header, Ascendancy.hpp, the ASC-EntryTask.hpp was included above the ASC-Task.hpp file, which would lead to the 'EntryTask' class inheriting from a class not even declared when EntryTask was declared..

Of course, simple beginner's mistake as it was, that was a very vexing experience.. And I still can't figure out why it borked all my curly braces [smile].... Cheers folks, and thanks for the input! Apparently, #include'ing in alphabetical order is not always the optimal setup :D


:)

To avoid this problem, you should #include "ASC-Task.hpp" in ASC-EntryTask.hpp. This costs nothing - well, maybe some compiler time, but I bet a difference of 20 milliseconds per file will not hurt you - and avoid this kind of errors.

One rule I always follow: if class B inherits from class A, then the declaration file of B includes the declaration file of A.


Seconded. One of the main reason for using those include guards in the first place is to allow you to do this.
Actually, on second look, it doesn't seem to be the cause of my problem, this is recurrant.. I change some things in other files, and boom, nothing works anymore.. If someone could take a look at the source, And perhaps point out exactly what is causing this glut of errors, I'd be most obliged [smile] The VC 6 wokrspace and project files are also included, don't know why, but I figured I may as well throw them in..

Cheers!

BTW, Guys, I think you misunderstood my system. Perhaps if you took a look at the files, you would understand how my method works, as I clearly can not explain it well enough.
Free speech for the living, dead men tell no tales,Your laughing finger will never point again...Omerta!Sing for me now!

This topic is closed to new replies.

Advertisement