gpt4 book ai didi

代码编辑器 - 仍然存在未解析的符号

转载 作者:行者123 更新时间:2023-11-30 16:27:54 26 4
gpt4 key购买 nike

我尝试读取陀螺仪数据。当我构建时,我总是遇到一些链接错误。我的输出如下;

**** Build of configuration Debug for project mpu6050_v1 ****

"C:\ti\ccsv7\utils\bin\gmake" -k -j 4 all -O 'Building file: ../main.c' 'Invoking: ARM Compiler' "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/Users/yilmaz/workspace_v7/mpu6050_v1" --include_path="C:/ti/TivaWare_C_Series-2.1.4.178" --include_path="C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include" --define=ccs="ccs" --define=PART_TM4C123GH6PM -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c" 'Finished building: ../main.c' ' ' 'Building target: mpu6050_v1.out' 'Invoking: ARM Linker' "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --define=ccs="ccs" --define=PART_TM4C123GH6PM -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi -z -m"mpu6050_v1.map" --heap_size=0 --stack_size=512 -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="mpu6050_v1_linkInfo.xml" --rom_model -o "mpu6050_v1.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "../tm4c123gh6pm.cmd" -llibc.a -l"C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/ccs/Debug/driverlib.lib"

undefined first referenced symbol in file --------- ---------------- MPU6050DataAccelGetFloat ./main.obj MPU6050DataGyroGetFloat ./main.obj MPU6050DataRead ./main.obj MPU6050Init ./main.obj MPU6050ReadModifyWrite ./main.obj

error #10234-D: unresolved symbols remain error #10010: errors encountered during linking; "mpu6050_v1.out" not built

Compilation failure makefile:143: recipe for target 'mpu6050_v1.out' failed gmake[1]: * [mpu6050_v1.out] Error 1 makefile:139: recipe for target 'all' failed gmake: * [all] Error 2

**** 构建完成 ****

我的代码如下。

#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include "sensorlib/i2cm_drv.h"
#include "sensorlib/mpu6050.h"
#include "sensorlib/hw_mpu6050.h"


//
// A boolean that is set when a MPU6050 command has completed.
//
volatile bool g_bMPU6050Done;

void MPU6050Callback(void *pvCallbackData, uint_fast8_t ui8Status);
void MPU6050Example(void);


/**
* main.c
*/
int main(void)
{



MPU6050Example();


return 0;
}

//
// The function that is provided by this example as a callback when MPU6050
// transactions have completed.
//
void MPU6050Callback(void *pvCallbackData, uint_fast8_t ui8Status)
{
//
// See if an error occurred.
//
if(ui8Status != I2CM_STATUS_SUCCESS)
{
//
// An error occurred, so handle it here if required.
//
}
//
// Indicate that the MPU6050 transaction has completed.
//
g_bMPU6050Done = true;
}

//
// The MPU6050 example.
//
void MPU6050Example(void)
{
float fAccel[3], fGyro[3];
tI2CMInstance sI2CInst;
tMPU6050 sMPU6050;

//
// Initialize the MPU6050. This code assumes that the I2C master instance
// has already been initialized.
//
g_bMPU6050Done = false;
MPU6050Init(&sMPU6050, &sI2CInst, 0x68, MPU6050Callback, 0);

while(!g_bMPU6050Done);

//
// Configure the MPU6050 for +/- 4 g accelerometer range.
//
g_bMPU6050Done = false;
MPU6050ReadModifyWrite(&sMPU6050, MPU6050_O_ACCEL_CONFIG, ~MPU6050_ACCEL_CONFIG_AFS_SEL_M,
MPU6050_ACCEL_CONFIG_AFS_SEL_4G, MPU6050Callback, 0);

while(!g_bMPU6050Done);

//
// Loop forever reading data from the MPU6050. Typically, this process
// would be done in the background, but for the purposes of this example,
// it is shown in an infinite loop.
//
while(1)
{
//
// Request another reading from the MPU6050.
//
g_bMPU6050Done = false;
MPU6050DataRead(&sMPU6050, MPU6050Callback, 0);

while(!g_bMPU6050Done);

//
// Get the new accelerometer and gyroscope readings.
//
MPU6050DataAccelGetFloat(&sMPU6050, &fAccel[0], &fAccel[1], &fAccel[2]);
MPU6050DataGyroGetFloat(&sMPU6050, &fGyro[0], &fGyro[1], &fGyro[2]);
//
// Do something with the new accelerometer and gyroscope readings.
//
}
}

请帮助我,任何建议。我已经尝试了好几天了。

最佳答案

我添加了 mpu6050.c 和 i2cm_drv.c 作为链接文件。项目->addfile->linked_to_file 就ok了。

solution

感谢您的帮助。我解决了评论中的问题

关于代码编辑器 - 仍然存在未解析的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52577256/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com