undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
-
- Posts: 20
- Joined: Mon Jul 10, 2023 9:14 am
undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
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
-
- .cpp->.c successful,otherwais fail
- 1.png (43.13 KiB) Viewed 1029 times
-
- Posts: 1696
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
Is port_det_stat() declared as extern "C" when used from C++? (cf. https://embeddedartistry.com/blog/2017/ ... -extern-c/)
-
- Posts: 20
- Joined: Mon Jul 10, 2023 9:14 am
Re: undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
yes,the .h header file include "extren "C"MicroController wrote: ↑Fri Sep 06, 2024 3:39 amIs port_det_stat() declared as extern "C" when used from C++? (cf. https://embeddedartistry.com/blog/2017/ ... -extern-c/)
- Attachments
-
- #ifdef __cplusplus
extern "C" {
#endif #ifdef __cplusplus
}
#endif - 1.png (36.84 KiB) Viewed 944 times
- #ifdef __cplusplus
Who is online
Users browsing this forum: No registered users and 198 guests