undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'

greenstone
Posts: 20
Joined: Mon Jul 10, 2023 9:14 am

undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'

Postby greenstone » Fri Sep 06, 2024 1:59 am

Why does a simple project compile successfully by changing the source file A.cpp of custom component A to A.c, otherwise there will be a link error for undefined reference to "port_det_stat() - (in custom component B)"
Attachments
1.png
.cpp->.c successful,otherwais fail
1.png (43.13 KiB) Viewed 1123 times

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'

Postby MicroController » Fri Sep 06, 2024 3:39 am

Is port_det_stat() declared as extern "C" when used from C++? (cf. https://embeddedartistry.com/blog/2017/ ... -extern-c/)

greenstone
Posts: 20
Joined: Mon Jul 10, 2023 9:14 am

Re: undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'

Postby greenstone » Fri Sep 06, 2024 7:58 am

MicroController wrote:
Fri Sep 06, 2024 3:39 am
Is port_det_stat() declared as extern "C" when used from C++? (cf. https://embeddedartistry.com/blog/2017/ ... -extern-c/)
yes,the .h header file include "extren "C"
Attachments
1.png
#ifdef __cplusplus
extern "C" {
#endif #ifdef __cplusplus
}
#endif
1.png (36.84 KiB) Viewed 1038 times

Who is online

Users browsing this forum: No registered users and 108 guests