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

error: function declaration isn't a prototype

[复制链接]

30

主题

26

回帖

4万

积分

管理员

积分
42068
发表于 2025-2-28 10:58:27 | 显示全部楼层 |阅读模式
出现这样的错误
../../src/drivers/engine_control/engine_control.c:379:5: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  379 | int process_ignite_logic()
      |     ^~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
make: *** [Makefile:226:px4_fmu-v6x_default] 错误 1




我的函数如下

int process_ignite_logic()
{
        //这里的参数,从参数表里获取后赋值
        // 可配置参数
        int config[] = {
                1,     // 重试间隔(秒)
                3,      // 最大尝试次数
                1100,   // 低电平值
                1900,   // 高电平值
                5000,   // 要求转速
                3000,  // 发动机高电平时间(毫秒)
                1000    // 发动机低电平时间(毫秒)
        };

        printf("Starting engine control system...\n");

        pthread_t ignition_thread;
        if (pthread_create(&ignition_thread, NULL,
                                simulate_ignition_thread, config)) {
                perror("Failed to create ignition thread");
                return 1;
        }

        void* thread_result;
        pthread_join(ignition_thread, &thread_result);

        printf("\nFinal status: %s\n",
                        (intptr_t)thread_result ? "OPERATIONAL" : "FAILURE");
        if((intptr_t)thread_result == OPERATIONAL)
        {

                _engine_fault = ENGINE_IGNITION_NON_ABNORMAL;
                return 0;
        }
        else
        {

                _engine_fault = ENGINE_IGNITION_ABNORMAL;
                return 1;
        }
}


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

30

主题

26

回帖

4万

积分

管理员

积分
42068
 楼主| 发表于 2025-2-28 10:59:02 | 显示全部楼层

int process_ignite_logic(void)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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