找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 13|回复: 1

error: invalid conversion from ‘void*’ to ‘int*’ [-fpermissive]

[复制链接]

30

主题

26

回帖

4万

积分

管理员

积分
42068
发表于 2025-2-28 10:20:26 | 显示全部楼层 |阅读模式
cuigaosheng@cuigaosheng:~$ g++ 113.c -lpthread
113.c: In function ‘void control_engine_sequence(int, int, int, int)’:
113.c:58:27: error: invalid conversion from ‘void*’ to ‘int*’ [-fpermissive]
   58 |  int* high_params = malloc(2 * sizeof(int));
      |                     ~~~~~~^~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
113.c:71:27: error: invalid conversion from ‘void*’ to ‘int*’ [-fpermissive]
   71 |   int* low_params = malloc(2 * sizeof(int));
      |                     ~~~~~~^~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
cuigaosheng@cuigaosheng:~$


我知道答案 回答被采纳将会获得 10 金钱 已有1人回答

30

主题

26

回帖

4万

积分

管理员

积分
42068
 楼主| 发表于 2025-2-28 10:57:14 | 显示全部楼层
在malloc前面加上(int*)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|flightreview|小黑屋|PX4-Autopilot|PX4论坛

GMT+8, 2025-3-12 23:27 , Processed in 0.053048 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表