MPU6050.c Error: #147-D: Declaration Incompatible with MPU_Set_Rate Function
The error message ' #147-D: declaration is incompatible with 'u8 MPU_Set_Rate(u16)' ' indicates an incompatibility between the function 'MPU_Set_Rate' declaration in the source file 'mpu6050.c' and its declaration in the header file 'mpu6050.h'.
In 'mpu6050.h', the function 'MPU_Set_Rate' is declared as returning a 'u8' (unsigned 8-bit integer) value and accepting a 'u16' (unsigned 16-bit integer) argument.
However, in 'mpu6050.c', the function 'MPU_Set_Rate' is defined with a different return type or argument type, causing the incompatibility error.
To resolve this, ensure the declaration and definition of 'MPU_Set_Rate' in both files are consistent in terms of return type and argument type.
For example, if the function should return an unsigned 8-bit integer and accept an unsigned 16-bit integer argument, modify the declaration in the header file and the definition in the source file as follows:
In 'mpu6050.h':
u8 MPU_Set_Rate(u16 arg);
In 'mpu6050.c':
u8 MPU_Set_Rate(u16 arg)
{
// Function implementation
}
Update any other references to the function 'MPU_Set_Rate' throughout your codebase accordingly.
原文地址: https://www.cveoy.top/t/topic/fNNq 著作权归作者所有。请勿转载和采集!