RT-Thread 移植STM32F429中遇到 error: conflicting types for 'fd_mask' typedef long fd_mask;

系统:Ubuntu 19.10
编译工具:GCC

在RT-Thread移植过程中遇到的问题

In file included from rt-thread/include/rtlibc.h:22:0,
                 from rt-thread/include/rtdef.h:1087,
                 from rt-thread/include/rtthread.h:24,
                 from board/board.h:14,
                 from board/board.c:11:
rt-thread/include/libc/libc_fdset.h:43:17: error: conflicting types for 'fd_mask'
 typedef long    fd_mask;
                 ^~~~~~~

In file included from /opt/gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/sys/types.h:68:0,
from /opt/gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/time.h:28,
from rt-thread/include/libc/libc_stat.h:82,
from rt-thread/include/rtlibc.h:15,
from rt-thread/include/rtdef.h:1087,
from rt-thread/include/rtthread.h:24,
from board/board.h:14,
from board/board.c:11:
/opt/gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/sys/select.h:45:23: note: previous declaration of ‘fd_mask’ was here
typedef unsigned long fd_mask;
^~~~~~~
在这里插入图片描述

此问题主要是RT-Thread 的libc(rt-thread/include/libc/libc_fdset.h)和系统头文件(/opt/gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/sys/select.h:)定义了相同定义之间的冲突。

解决办法:
可以通过在makefile文件里面添加宏定义的方法来解决。

-DRT_USING_NEWLIB

如下图,


再次执行 make 后,无定义冲突的错误。

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值