2013-07-13 2 views
2

에 모호한 전화 :건물 libspline - 가능 여기에 과부하 기능 '펑'내가 Windows에서 matlab에 대한 libspline를 구축하기 위해 노력하고있어

http://ttic.uchicago.edu/~smaji/projects/libspline-release1.0.tar.gz

나는 다음과 같은 오류가 발생합니다 :

>> make 
additiveModel.cpp 
additiveModel.cpp(156) : error C2668: 'pow' : ambiguous call to overloaded function 
     C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(583): could be 'long double pow(long double,int)' 
     C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(535): or  'float pow(float,int)' 
     C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(497): or  'double pow(double,int)' 
     while trying to match the argument list '(int, int)' 

    C:\USR\ML\MATLAB~1\BIN\MEX.PL: Error: Compile of 'additiveModel.cpp' failed. 

??? Error using ==> mex at 208 
Unable to complete successfully. 

Error in ==> make at 4 
mex -O -largeArrayDims -c additiveModel.cpp 

해결 방법? pow에 전달되는 인수 모두 int의가 있음을 볼 수 있습니다 여기에

dimwts[2*i] = 1.0/pow(i+1,reg); 

:

답변

2

라인 additiveModel.cpp 156이있다. math.hpow의 과부하가 없으므로 int이 두 개가 걸릴 것이므로 실행 가능성이 가장 좋은 함수은이 경우 고유하지 않으므로 과부하 해결에 실패합니다.

당신은 적절한 유형의 첫 번째 매개 변수를 캐스팅하여이 문제를 해결할 수 등 double 등 :

dimwts[2*i] = 1.0/pow(static_cast<double>(i+1),reg);