Mar 11, 2016 at 3:59pm UTC
Probably because you didn't add s.cpp to your project or compile line so the linker couldn't find the implementation.
Mar 11, 2016 at 4:04pm UTC
Are you talking about a compile-time error, or a link-time error?
If you have error messages, then tell us what those errors are . I cannot understand why you thought it would be better to withhold that information from us!
Mar 11, 2016 at 4:15pm UTC
Thank you for your response. It is a link-time error and it is said : "Function 'calculate' could not be resolved". I use Eclipse for write down codes
Mar 11, 2016 at 4:17pm UTC
Thanks jlb for your comment.
What is compile line?
all of my files is in one project.
Mar 11, 2016 at 4:26pm UTC
One obvious thing is that you've defined your function as:
float Sim::calculate(float e){}
What is Sim ? A namespace? A class?
The snipped of calling code you've shown us doesn't give us any clue about how it knows that it's looking for the function in something called Sim .
Last edited on Mar 11, 2016 at 4:46pm UTC
Mar 11, 2016 at 4:36pm UTC
Sim is the class that is defined in the h file of the s page
Mar 11, 2016 at 4:46pm UTC
And that bit of code you've shown us that tries to call calculate() - is that part of the class too?
Because if it isn't, then the code is trying to call a free function called calculate() , which is not the same thing as Sim::calculate() .
Mar 11, 2016 at 4:59pm UTC
class Sim {
public:
float calculate(float e)
}
yes it is defined in this s.h page
Mar 11, 2016 at 5:04pm UTC
I'm asking about the code that calls calculate(). It needs to call that method on an object of type Sim . Where is that object?