请选择 进入手机版 | 继续访问电脑版

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

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

[复制链接]

39

主题

32

回帖

4万

积分

管理员

积分
42129
发表于 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人回答

39

主题

32

回帖

4万

积分

管理员

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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