1:现象

编译时突然出现很多莫名的错误

n file included from /tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.4/include/stdint.h:9:0,
                 from ./common/log.h:15,
                 from mqtt/mqtt_client.c:18:
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h: In function 'mqtt_init':
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:48:24: error: storage class specified for parameter 'uint8_t'
 typedef unsigned char  uint8_t;
                        ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:49:28: error: storage class specified for parameter 'uint16_t'
 typedef unsigned short int uint16_t;
                            ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:51:23: error: storage class specified for parameter 'uint32_t'
 typedef unsigned int  uint32_t;
                       ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:57:1: error: expected declaration specifiers before '__extension__'
 __extension__
 ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:65:22: error: storage class specified for parameter 'int_least8_t'
 typedef signed char  int_least8_t;
                      ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:66:20: error: storage class specified for parameter 'int_least16_t'
 typedef short int  int_least16_t;
                    ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:67:15: error: storage class specified for parameter 'int_least32_t'
 typedef int   int_least32_t;
               ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:71:1: error: expected declaration specifiers before '__extension__'
 __extension__
 ^
/tools/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/stdint.h:76:24: error: storage class specified for parameter 'uint_least8_t'
./common/log.h:27:3: error: storage class specified for parameter 'log_level_t'
 } log_level_t;
   ^
./common/log.h:40:3: error: storage class specified for parameter 'log_attr_t'
 } log_attr_t;
   ^
./common/log.h:43:15: error: expected declaration specifiers or '...' before 'log_attr_t'
 void log_init(log_attr_t *attr);
               ^
mqtt/mqtt_client.c:23:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
mqtt/mqtt_client.c:82:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
mqtt/mqtt_client.c:91:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
mqtt/mqtt_client.c:113:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
mqtt/mqtt_client.c:216:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
In file included from mqtt/mqtt_client.c:16:0:
mqtt/mqtt_client.h:25:11: error: old-style parameter declarations in prototyped function definition
 MQTTAsync mqtt_init(const char* server_uri, const char *client_id, MQTTAsync_messageArrived* msg_arrive)
           ^
mqtt/mqtt_client.c:248:1: error: expected '{' at end of input
 }
 ^
mqtt/mqtt_client.c:248:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

其中有一条是

mqtt/mqtt_client.h:25:11: error: old-style parameter declarations in prototyped function definition

2:原因

在头文件中添加函数说明的时候,结尾没有加分号导致的
在这里插入图片描述

3:解决

在缺失分号的地方添加分号

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐