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
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 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.