im a beginner and using C++ 2008 edition and this pow function isnt working on it although its working perfectly ob C++6. please help. THIS IS PART OF THE CODE:

``````#include<iostream>
#include<cmath>
using namespace std;
int det (int **oldray,int order)
{
int deter=0,i,k;

int **newray;
newray=new int*[order-1];
for( i=0;i<order;i++)
newray[i]=new int [order-1];

if(order==2)
return (oldray[0][0]*oldray[1][1])-(oldray[0][1]*oldray[1][0]);
else
{
for(i=0;i<=0;i++)
{
for( k=0;k<order;k++)
{
cout<<i<<k<<": "<<pow(-1,i+k)*oldray[i][k]<<endl;
cpy(oldray,newray,i,k,order);
deter=deter+(pow(-1,i+k)*oldray[i][k] * det(newray,order-1));
cout<<"  determinant is "<<deter <<endl;
}
}
}
return deter;
}``````

THESE ARE THE ERRORS:
1>c:\users\ikc\documents\visual studio 2008\projects\inv2\inv2\inv2.cpp(145) : error C2668: 'pow' : ambiguous call to overloaded function
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(575): could be 'long double pow(long double,int)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(527): or 'float pow(float,int)'
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(489): or 'double pow(double,int)'
1> while trying to match the argument list '(int, int)'

Its probably finding the first argument ambigious as the compiler is considering -1 to be an integer.

maybe try,

``````long double neg1=-1;
cout<< pow(neg1,i+k);``````

However i'm not sure whether this would work.

Changing the -1 to a -1.0 should do the trick. There is no overload of that function that takes an integer for the first argument.

thanks..
but now its giving these kin of errors
'expl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2039: 'fabsl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2873: 'fabsl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2039: 'floorl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2873: 'floorl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2039: 'fmodl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(33) : error C2873: 'fmodl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2039: 'frexpl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2873: 'frexpl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2039: 'ldexpl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2873: 'ldexpl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2039: 'logl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(34) : error C2873: 'logl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2039: 'log10l' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2873: 'log10l' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2039: 'modfl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2873: 'modfl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2039: 'powl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(35) : error C2873: 'powl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2039: 'sinl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2873: 'sinl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2039: 'sinhl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2873: 'sinhl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2039: 'sqrtl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(36) : error C2873: 'sqrtl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(37) : error C2039: 'tanl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(37) : error C2873: 'tanl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(37) : error C2039: 'tanhl' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(37) : error C2873: 'tanhl' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(41) : error C2039: 'acos' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(41) : error C2873: 'acos' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(41) : error C2039: 'asin' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(41) : error C2873: 'asin' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2039: 'atan' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2873: 'atan' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2039: 'atan2' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2873: 'atan2' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2039: 'ceil' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(42) : error C2873: 'ceil' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(43) : error C2039: 'cos' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(43) : error C2873: 'cos' : symbol cannot be used in a using-declaration
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(43) : error C2039: 'cosh' : is not a member of '`global namespace''
1>c:\program files\microsoft visual studio 9.0\vc\include\cmath(43) : fatal error C1003: error count exceeds 100; stopping compilation

Are you using the correct namespace? Can you post your #include and using statements?

#include<iostream>
#include<cmath>
using namespace std;

well i copied your code and tried to compile it. Looks like, other than line 22 of your code the rest will compile fine if you take jonsca's advice and make the call to pow as

``pow(-1.0,i+k)``

. It just gives you a warning regarding possible loss of precision.
The second set of errors are definitely not due to a wrong call to pow. Or so I guess.

BTW, even I compiled it using Visual Studio 9.0 (i.e. VS 2008).

I had an assignment last semester that had this issue built in to it that we had to work around. It's really the second argument that makes the difference because there is no definition of pow() for pow(int,int). Since an int can be automatically cast to either float or double, instead it tries to call (using template notation for simplicity) either the pow(<T>, float) or the pow(<T>,double) overload version(s). As a result, it can't decide which version to use.

If you absolutely must use integers for i and k, I would suggest a cast when you call pow(). If you cast the second argument, you explicitly request a specific overloaded version.

``pow( neg1, (double)i+k)``

nvm. I pulled the assignment, it was the first argument that I had to change... :( :\$