#include<iostream>
using namespace std;
int div(int m,int n)
{int a,r,b;
if (m>n)
{a=m;b=n;}
else
{a=n;b=m;}
r=b;
while (r!=0)
{r=a%b;
a=b;
b=r;}
return a;}
int gb(int a,int m,int n)
{int d;
d=m*n/a;
return d;}
int main()
{int m,n,a,d;
cin>>m>>n;
a=div(m,n);
d=gb(a,m,n);
cout<<a<<" "<<d;}
题目是用两个自定义函数求公约公倍数,由主函数调用,我写的在C4droid编译通过运行也正常,在学校OJ上就编译错误,求解
解决了,感谢@HCJ

Main.cc: In function ‘int div(int, int)’:
Main.cc:3:20: error: ambiguating new declaration of ‘int div(int, int)’
int div(int m,int n)
^
In file included from /usr/include/c++/5/cstdlib:72:0,
from /usr/include/c++/5/ext/string_conversions.h:41,
from /usr/include/c++/5/bits/basic_string.h:5247,
from /usr/include/c++/5/string:52,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from Main.cc:1:
/usr/include/stdlib.h:788:14: note: old declaration ‘div_t div(int, int)’
extern div_t div (int __numer, int __denom)
^
Main.cc: In function ‘int main()’:
Main.cc:22:2: error: cannot convert ‘div_t’ to ‘int’ in assignment
a=div(m,n);
^