首页 > 解决方案 > 声明与“__interwork __vfp”不兼容

问题描述

我正在使用 C 语言使用 IAR Embedded Workbench。

我收到以下错误:

Error[Pe147]: declaration is incompatible with "__interwork __vfp void test()" (declared at line 1 of "C:\test_Project\test\EWARM/../Inc\test.h") C:\test_Project\test\Src\test.c 3

test.h 的内容

void test();

test.c 的内容

#include "test.h"

void test(UART_HandleTypeDef *huart, float *data, uint16_t send_size)
{
    //omission
}

如果我删除uint16_t send_size测试函数的参数,编译成功。

这怎么解释?

标签: ccompiler-errorsworkbenchiarfunction-declaration

解决方案


该错误意味着在 test.h 中声明 test() 的方式与在 test.c 中实现的方式之间存在差异。您的函数参数必须匹配。

在 test.h 中,而不是

void test();

利用

void test(UART_HandleTypeDef *huart, float *data, uint16_t send_size);

推荐阅读