It is because the pow function used here has no matching definition in std namespace. However you are not even using std so its strange that you get an error.
Because I could compile it without using namespace std, but get an error upon using it.
The program compiles fine with g++ 3.4.6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <cmath>
float setprecision(float result, int round)
{
result=result*pow(10,round);
int y=(int) result;
result=y/(pow(10,round));
return result;
}
int main()
{
float x = setprecision(10.0, 2);
std::cout<<x<<std::endl;
return 0;
}