Calling Functions

I have a function called polynomialFunction() in my file derivative.cpp and am trying to call it in main.cpp. derivative.h is included in main with
#include "derivative.h"

And later inside main i try to call the function by

int main() {

.......
polynomialFunction();
........
return 0;
}

Can someone tell me my error here?
is polynomialFunction() a function of a class? If so you need an object of that class to call the function. Such as:
1
2
Derivative derivative;
derivative.polynomialFunction();
And where would these be located?
You would put those in the int main() function.
so would the Derivative derivative; be above main or inside. And then would i call derivative.polynomialFunction(); where i have it now?
Well i cant see the rest of your code, but i would say yeah dont move it. As for where to put Derivative derivative;, Anywhere before the function call in the same scope. I would put it as the first line inside the main() function just to be safe.
Ok. So i have Derivative derivative on the line below main() and the derivative.polynomialFunction(); in the same place but i am still having problems with a bug somewhere in the program. I don't know hot to debug it in Visual Studio. and no red lines appear showing that the code is not working do you know how to do this?
If there is an error post the error.


If it compiles fine but breaks during execution, step through it line by line. To step through(debug) put a break point at the beginning of main. To do this click on the bar beside the code. A red ball should appear where you clicked. When you run the code it will stop at this red ball and you can Step Over lines of code until you get the line that stops the program.
Topic archived. No new replies allowed.