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

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

[复制链接]

130

主题

44

回帖

3万

积分

管理员

积分
39544
发表于 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:~$


130

主题

44

回帖

3万

积分

管理员

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

本版积分规则

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

GMT+8, 2026-4-8 23:04 , Processed in 0.033716 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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