error: Undefined reference for function definition in ble_gatts.c

Learn MoreFAQsTutorials

10 posts / 0 new
Last post
prasanna
Offline
Last seen:13 hours 34 min ago
加入:2020-09-29 11:56
error: Undefined reference for function definition in 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
Offline
Last seen:5 hours 22 min ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

Could you please share a screenshot? Please try to right-click into your project from the “Project explorer” window, and then click Index-> Rebuild. After that, close and re-open the project.

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:13 hours 34 min 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) Also, most of the time, I have to import the projects freshly when I open the IDE. how to solve this issue?

问候,

Prasanna

PM_Dialog
Offline
Last seen:5 hours 22 min 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文件的位置?

If you are starting a new project, please follow theDA1469X教程启动项目,

Thanks, PM_Dialog

prasanna
Offline
Last seen:13 hours 34 min 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
Offline
Last seen:5 hours 22 min 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:13 hours 34 min 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
Offline
Last seen:5 hours 22 min 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:13 hours 34 min ago
加入:2020-09-29 11:56
Dear PM_Dialog,

Dear PM_Dialog,

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

Thank you.

问候,

Prasanna

PM_Dialog
Offline
Last seen:5 hours 22 min ago
Staff
加入:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

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

Thanks, PM_Dialog