在VS2013运行出现了这个错误,但是换到g++编译就没有问题了。
百度一波没找到解决方法,排除法找到了错误,原来是count函数,
如果你重载了一个三个参数的count函数(当然你传的参数只要不是已经有的重载函数即可),
会编译如上图错误。
count这个函数是<algorithim>内用于计算容器内元素数目的函数。
下面的代码就会编译错误。
当然你可能与其他函数冲突了,建议使用排除法来找到错误。
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int mod = 1e9 + 7;
typedef long long ll;
void count(int a, int b, int c)
{
cout << a << endl;
}
int main()
{
#ifdef LOCAL
freopen("E:/input.txt", "r", stdin);
#endif
count(1, 1, 1);
return 0;
}
下面的就可以运行。
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int mod = 1e9 + 7;
typedef long long ll;
void count(int a, int b)
{
cout << a << endl;
}
void count(int a, int b, int c, int d)
{
cout << a << endl;
}
int main()
{
#ifdef LOCAL
freopen("E:/input.txt", "r", stdin);
#endif
count(1, 1);
count(1, 1, 1, 1);
return 0;
}
找到错误之后可以选择,改变参数,避免跟库函数重载相同的函数,或者改变函数名称来解决。