CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 34 of 34
  1. #31
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Transferring Structure variables?(simple problem)

    You're passing buddy to nodeCount rather than root in treeNodeCount. This would be a strange but valid choice except for one thing: binaryTreeType<elemType>::buddy is never modified in makeTree, since it is shadowed by the local variable called buddy.

    Just pass root in treeNodeCount.

  2. #32
    Join Date
    Nov 2008
    Posts
    15

    Re: Transferring Structure variables?(simple problem)

    The exe still crashes. :/

    and I deleted the local buddy variable, changed it to root, and it still crashes. What gives?

  3. #33
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Transferring Structure variables?(simple problem)

    Quote Originally Posted by pyromonki View Post
    The exe still crashes. :/

    and I deleted the local buddy variable, changed it to root, and it still crashes. What gives?
    Now is the time to go step-by-step using the debugger on an unoptimized "debug" build.

    Regards,

    Paul McKenzie

  4. #34
    Join Date
    Nov 2008
    Posts
    15

    Re: Transferring Structure variables?(simple problem)

    I figured it out. I went back and realized the two problems:

    1. I was using llink and rlink in the class functions, yet they were never defined, so there were no values, I replaced them with left, and right that I used to build the tree, and deleted the initialization of them.

    2. The biggest problem of them all was, instead of putting the #include"treeimp.cpp" at the bottom of the header, I needed to put it in the test file.

    After I did that, it worked perfectly.

    I didn't think about it, until I went back and reread some posts, especially the one where Lindley said the problem was that all the class defining files need to be linked.

    The only one that wasn't "connected" was the test file, so I put the header made out of the implementation file there.

Page 3 of 3 FirstFirst 123

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured