warning: return type defaults to ‘int’ [-Wimplicit-int]
时间: 2024-02-12 08:09:44 浏览: 61
这个警告信息是由于函数没有明确指定返回值类型,编译器默认将其返回类型设为 int。这个警告信息可能会导致意想不到的错误,因此建议在函数声明时显式指定返回类型,例如:
```
void functionName() {
// do something
}
```
应该改为:
```
int functionName() {
// do something
return 0;
}
```
这样可以避免一些编译错误,同时也使代码更易于理解。
相关问题
root@wei:/opt/rt6856_2013/RT288x_SDK/source# make menuconfig --> exit --> yes\(save\) Makefile:396: *** mixed implicit and normal rules: deprecated syntax /bin/sh: 1: /mipsel-linux-uclibc-gcc: not found /bin/sh: 1: /mipsel-linux-uclibc-gcc: not found lxtemp.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int] main() {} ^ /usr/bin/ld: cannot find -lncurses collect2: error: ld returned 1 exit status make[1]: *** [ncurses] Error 1 make: *** [menuconfig]Error 2 想在ubuntu16.04版本编译D-link 636l地bin文件错误如上我需要解决方法
根据提示,可能是缺少依赖库导致编译出错。
1. 首先,你需要安装交叉编译工具链 `mipsel-linux-uclibc-gcc`。
你可以通过以下命令安装:
```
sudo apt-get install gcc-mipsel-linux-gnu
```
2. 然后,你需要安装 `ncurses` 库。你可以通过以下命令安装:
```
sudo apt-get install libncurses5-dev
```
这应该会解决你的问题。如果问题仍然存在,请检查你的环境变量和交叉编译工具链路径是否正确。
25 1 D:\东北?笱?计?慊?专?挡?作?低?课?鑌?紊?报?鎈filesys源??\main.c [Warning] return type defaults to 'int' [-Wimplicit-int]
这个警告信息是因为在main函数中没有显式地指定返回值类型,C语言默认将返回值类型设为int。如果你不打算在main函数中返回任何值,可以在main函数头部显式地将返回值类型设为void,例如:
```
void main() {
// your code here
}
```
如果你想在main函数中返回一个值,可以将返回值类型改为你想要的类型。例如:
```
int main() {
return 0;
}
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)