3
我有我的代碼如下聲明:爲什麼我得到鐺警告:沒有以前的原型功能「差異」
//Central diff function, makes two function calls, O(h^2)
REAL diff(const REAL h, const REAL x, REAL (*func)(const REAL))
{
// diff = f(x + h) - f(x -h)/2h + O(h^2)
return ((*func)(x + h) - (*func)(x - h))/(2.0*h + REALSMALL);
}
這正好處於「utils.h」文件。當我編譯一個測試使用它,它給了我:
clang++ -Weverything tests/utils.cpp -o tests/utils.o
In file included from tests/utils.cpp:4:
tests/../utils/utils.h:31:6: warning: no previous prototype for function 'diff' [-Wmissing-prototypes]
REAL diff(const REAL h, const REAL x, REAL (*func)(const REAL))
我在這裏失蹤?