'foo' was not declared in this scope c++

后端 未结 3 1052
醉话见心
醉话见心 2020-11-27 19:52

I\'m just learning c++ (first day looking at it since I took a 1 week summer camp years ago)

I was converting a program I\'m working on in Java to C++:



        
3条回答
  •  情深已故
    2020-11-27 20:34

    In C++, your source files are usually parsed from top to bottom in a single pass, so any variable or function must be declared before they can be used. There are some exceptions to this, like when defining functions inline in a class definition, but that's not the case for your code.

    Either move the definition of integrate above the one for getSkewNormal, or add a forward declaration above getSkewNormal:

    double integrate (double start, double stop, int numSteps, Evaluatable evalObj);
    

    The same applies for sum.

提交回复
热议问题