c++中函数返回类型为auto时报错。
//myfunc.h中声明
auto qwe();
//myfunc.cpp中定义
#include "myfunc.h"
auto qwe()
{
return 1;
}
//main.cpp中
int main() {
cout<<qwe();
return 0;
}
运行结果及详细报错内容
Function 'qwe' with deduced return type cannot be used before it is defined
想知道为什么显式的写了返回类型的这样写不会报错,而用auto会报错,并且如何修改