Thread: error: undeclared (need some help)

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It does. It is supposed to compute the value and return it.
    That implies that you do not need a yIntercept member variable unless you intend to perform caching of the value, but that does not seem to be the case here.

    With the way it was set up the instructor was initializing those variables locally (yIntercept and slope) so I only put them in the .h file after it was giving me an error message (the one I had earlier).
    I suggest that you revert to the header file that your instructor provided.

    Either way I got rid of the initialization in the local part of the program and it didn't change anything.
    What do you mean by "got rid of the initialization in the local part of the program"? There is no such thing as "the local part of the program", since locality depends on your point of reference.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Feb 2008
    Posts
    9
    I just reverted to the old header file, and decided to take a screenshot to possibly clear it up:

    http://img90.imageshack.us/img90/9528/lab2imageja3.png

    Hopefully this helps.

    And sorry, when I said locally I meant in relation to what i was working on (the yIntercept part).

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I just reverted to the old header file, and decided to take a screenshot to possibly clear it up:
    That's your source file for the Segment class implementation, not the "Segment.h" header.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed