错误:BLE_GATTS.C中的函数定义的未定义引用

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
prasanna
Offline
Last seen:1 week 5 days ago
加入:2020-09-29 11:56
错误:BLE_GATTS.C中的函数定义的未定义引用

Hi Dialog,

I could able to resolve the No such file or directory error by including the sevices path in the c++ build tool settings. But now, i ran into another problem of Undefined refernece for the functions defined in gatts.c.

The file custom_service.c which I added to the project has functions that are called from ble_gatts.c. But when I try to build I am geting this error undefined reference for the function "ble_gatts_read_cfm" and for all other functions that are defined in the ble_gatts.c. I added the headefile ble_gatts.h to custom_service.c and checked the properties. I am not understanding whats was wrong.

Thanks in advance.

问候,

Prasanna

Device:
PM_Dialog
Online
Last seen:8 min 30 sec ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

你能分享一个截图吗?请尝试从“Project Explorer”窗口右键单击您的项目,然后单击索引 - >重建。之后,关闭并重新打开项目。

This is an SDK file, so I assume that something you are getting wrong with the include paths.

What is the version of the SmartSnippets Studio?

Thanks, PM_Dialog

prasanna
Offline
Last seen:1 week 5 days ago
加入:2020-09-29 11:56
Hi Dialog PM,

Hi Dialog PM,

I am using the Smartsnippets Studio version v2.0.14. 1749. Please find the error messages below.

/usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: ./custom_service.o: in function `do_char_value_read': /home/prasanna/DiaSemi/SDK_10.0.10.118/projects/dk_apps/demos/ble_adv/DA1469x-00-Debug_QSPI/../custom_service.c:163: undefined reference to `ble_gatts_read_cfm' /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: /home/prasanna/DiaSemi/SDK_10.0.10.118/projects/dk_apps/demos/ble_adv/DA1469x-00-Debug_QSPI/../custom_service.c:152: undefined reference to `ble_gatts_read_cfm' /usr/lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/ld: ./custom_service.o: in function `mcs_notify_char_value': /home/prasanna/DiaSemi/SDK_10.0.10.118/projects/dk_apps/demos/ble_adv/DA1469x-00-Debug_QSPI/../custom_service.c:222: undefined reference to `ble_gatts_send_event'

I rebuild the project like you said from the index. But, i see the same errors. I have checked the include paths of my created files custom_service.c where api/include (since ble_gatts.c is under sdk/ble/api) is added to the project include path. Also, I wanted to notify you that when I try to click (ctrl+left click) on the functions used for calling in custom service.c, they are pointing to the ble_gatts.h headerfile. In general, they should be pointing to functions defined in ble_gatts.c. So, i understand that ble_gatts.c is somehow not recognised by the compiler for linking. How can I get rid of this?

2)此外,大多数情况下,我必须在打开IDE时新鲜导入项目。如何解决这个问题?

问候,

Prasanna

PM_Dialog
Online
Last seen:8 min 30 sec ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

Sorry bur I am little bit confused. Is this occurred to any of the SDK examples or, in your custom code?

您是否修改或更改了任何SDK文件的位置?

如果您正在启动新项目,请按照DA1469X教程启动项目,

Thanks, PM_Dialog

prasanna
Offline
Last seen:1 week 5 days ago
加入:2020-09-29 11:56
Hello PM_Dialog,

Hello PM_Dialog,

I did not modify the location of any SDK files. I am using the example ble_adv demo and trying to add two files custom_service.c and custom_service.h where the above mentioned error occurs while building the project. ble_gatts.c is not getting recognised by the compiler.

问候,

Prasanna

PM_Dialog
Online
Last seen:8 min 30 sec ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

Please give a try in a clean SDK directory with the .metadata folder deleted. After that, import the ble_adv project of the SDK, build it and verify that all is working OK. Then, import your own files. Please also take some screenshots with the steps you are following and share them with me.

Thanks, PM_Dialog

prasanna
Offline
Last seen:1 week 5 days ago
加入:2020-09-29 11:56
hello PM_Dialog,

hello PM_Dialog,

I have deleted the .metadata folder from SDK, imorted the project and tried to run. But, the errors remain the same. I attached some screeshots which might give you more insights.

问候,

Prasanna

Attachment:
PM_Dialog
Online
Last seen:8 min 30 sec ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

I am using theDA1469x Custom bluetooth serviceand I am not abel to replicate it. Please try to use handle_write_req() function which calls the ble_gatts_write_cfm() as provided in this software example.

Thanks, PM_Dialog

prasanna
Offline
Last seen:1 week 5 days ago
加入:2020-09-29 11:56
Dear PM_Dialog,

Dear PM_Dialog,

我能解决这个错误。我想出了在特定的.c文件中使用的宏未定义和启用。我定义了宏,问题解决了。

Thank you.

问候,

Prasanna

PM_Dialog
Online
Last seen:8 min 30 sec ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

高兴你找到你的问题和thanks for the indication.

Thanks, PM_Dialog