错误:在SDK中添加新文件时,没有此类文件或目录,请在ble_service.c中调用返回函数定义

了解更多常见问题解答教程

6个帖子/ 0新
最后一篇
普拉斯坦娜
离线
最后一次露面:10小时6分钟前
加入:2020-09-29 11:56
错误:在SDK中添加新文件时,没有此类文件或目录,请在ble_service.c中调用返回函数定义

亲爱的对话框,

1.在自定义服务创建过程中,我在ble_adv演示项目的“sdk - > ble-> services”文件夹中创建了两个文件custom_service.h和custom_service.c。我正在使用SDK 10.0.10。当我尝试构建项目时,我为custom_service.h收到此错误。

“致命错误:custom_service.h:没有这样的文件或目录
#include“custom_service.h”
| ^~~~~~~~~~~~~~~~~~

我不了解这个新文件的增加了什么。它们处于正确的路径,并且其项目位置是相同的。我也检查了C / C ++构建设置中的包含路径。一切都看起来很好。我要求您请帮助我,因为我无法测试我的新增版本是否正在工作。

2.在I /ble_adv/sdk/ble/services/includes/ble_service.h和/ ble_adv / sdk / ble / services中,我对在BLE_SERVICE.H和BLE_SERVICE.C文件中的呼叫回函数原型及其定义中有一些困惑src / ble_service.c文件在SDK中欣赏。我将在这里附上一个功能来解释我不明白的东西。

//呼叫BLE_Service.h键入的函数原型(* connected_evt_t)(ble_service_t * svc,const ble_evt_gap_connected_t * evt);//我假设以下是上面的回拨函数(connected_evt)定义静态void连接_evt(const ble_evt_gap_connected_t * evt){int i;for(i = 0; i  connected_evt){svc-> connected_evt(EVT);}}}

所以,在这里我没有得到的是

1. If (*connected_evt_t) is pointing to the connected_evt() function, why the first argument (ble_service_t *svc) is not passed in the function definition. Since the prototype and the definition should be same with number of argments?

提前致谢。

问候,普拉萨纳

设备:
PM_DIALOG.
离线
最后一次露面:6小时29分钟前
员工
加入:2018-02-08 11:03
嗨普拉斯坦尼亚,

嗨普拉斯坦尼亚,

正如您在初始帖子中提到的那样,您已开始开发自己的项目。所以,请你看看DA1469X教程启动项目要确保设置可以确定吗?在第2节中,您还可以找到包含自己文件的步骤。

你能不能用错误拍摄截图并分享它?

typedef struct ble_service ble_service_t;是一个全球结构。

谢谢,PM_DIALOG.

普拉斯坦娜
离线
最后一次露面:10小时6分钟前
加入:2020-09-29 11:56
嗨pm_dialog,

嗨pm_dialog,

我已经从SDK导入了BLE_ADV演示项目并开始更改它。在此过程中,我将Custom_service.h和custom_service.c添加到“SDK - > BLE-> Services”分别包含和源文件。这是对现有演示项目进行更改的正确方法吗?请在附加有关添加文件到BLE_ADV演示项目的错误。

错误当添加新文件构建fi SDKle: /home/prasanna/DiaSemi/SDK_10.0.10.118/sdk/interfaces/ble/services/src/custom_service.c Invoking: Cross ARM C Compiler /home/prasanna/DiaSemi/SDK_10.0.10.118/sdk/interfaces/ble/services/src/custom_service.c:49:10: fatal error: custom_service.h: No such file or directory 49 | #include "custom_service.h" | ^~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [sdk/ble/services/src/subdir.mk:116: sdk/ble/services/src/custom_service.o] Error 1 make: *** [makefile:60: all] Error 2 "make --silent all" terminated with exit code 2. Build might be incomplete.

同样,我遇到了另一个问题。无论我在SDK下对一个演示项目做的更改,它们都申请了其他演示项目,因为它们与SDK相同。例如,如果我将一个标题文件添加到ble-> service->包含ble_adv项目,则它们也会自动添加到ble_custom_service项目的相同路径中。这为我带来了删除和添加文件的其他问题。请告诉我如何纠正这个问题。

PM_DIALOG.
离线
最后一次露面:6小时29分钟前
员工
加入:2018-02-08 11:03
嗨普拉斯坦尼亚,

嗨普拉斯坦尼亚,

你提到这个问题已经解决了这个机票,没有吗?

https://support.dialog-semicondiondiondimicon.com/forums/post/dialog-smartbond-bluetooth-low-energy -%e2%80%93-software/Error-undefinned-reference-function.

你能澄清第二个问题吗?有教程和SW示例演示如何实现自定义服务。您无需修改​​任何SDK文件。

谢谢,PM_DIALOG.

普拉斯坦娜
离线
最后一次露面:10小时6分钟前
加入:2020-09-29 11:56
嗨pm_dialog,

嗨pm_dialog,

我的第二个问题。

我目前正在使用两个演示项目。一个是“ble-adv”演示,另一个是“da1469x_custom_ble_service_sample_code”。我想复制在SDK / BLE / SERVICE文件夹中的“da1469x_custom_ble_service_service_sample_service_sample_sample_sample_sample_service_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample_sample _sample _sample_sample _sample中的文件。因此,现在发生的情况是那些文件也被复制到BLE / Services文件夹中的“Custom_ble_service_sample_code”SDK。

Sumary: The new files added to one demo project inside the sdk are automatically seen in other project sdk. So, I understood its better to add own files outside the sdk. Is this correct?

问候,普拉萨纳

PM_DIALOG.
离线
最后一次露面:6小时29分钟前
员工
加入:2018-02-08 11:03
嗨普拉斯坦尼亚,