Getting ": undefined reference to " error in project directory

kesha.modhia
Posts: 53
Joined: Fri May 13, 2022 12:36 pm

Getting ": undefined reference to " error in project directory

Postby kesha.modhia » Fri Jul 04, 2025 7:08 am

Hello,

I am getting undefined referance to error in my esp32 project
below is my project sturture

VWDIHD
├── components
| ├── ZIGbeeSDK
│ └── platform
│ └── inc
| | |- abc.h file extern uint16_t ashAckTimer;
| | #define ashStopAckTimer() do { ashAckTimer = 0; }
│ └── SRC
| | |- abc.c file uint16_t ashAckTimer; //
│ └── CMakeLists.txt
| SRC "abc.c"
| INCLUDE_DIRS "/inc"
├── main
│ └── CMakeLists.txt [init point]
|
|- CMakeLists.txt

the error i am getting is
undefined reference to `ashAckTimer'
FYI : kept header file in source "abc.c" file

Kindly let me know the reason
using espidf v5.4.1 with zigbee SDK4.4.6
Attached a image of projet where getting error

Kindly let me know the reasons
Attachments
aaCapture.PNG
aaCapture.PNG (13.71 KiB) Viewed 81 times

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

Re: Getting ": undefined reference to " error in project directory

Postby MicroController » Fri Jul 04, 2025 11:27 am

From what you show I'm pretty sure there are more errors and/or warnings put out by the build process, which are relevant.

As a start, change

Code: Select all

SRC "abc.c"
INCLUDE_DIRS "/inc"
to

Code: Select all

SRC "SRC/abc.c"
INCLUDE_DIRS "inc"
in the CMakeLists.txt.

kesha.modhia
Posts: 53
Joined: Fri May 13, 2022 12:36 pm

Re: Getting ": undefined reference to " error in project directory

Postby kesha.modhia » Mon Jul 07, 2025 9:35 am

Yes, I already have written that as you suggested

VWDIHD
├── components
|-----├── ZIGbeeSDK
│ └── platform
│ └── inc
| |- abc.h file extern uint16_t ashAckTimer;
| | #define ashStopAckTimer() do { ashAckTimer = 0; } while (false)
│ └── SRC
| |- abc.c file uint16_t ashAckTimer; //
│ └── CMakeLists.txt
| SRC "SRC/abc.c"
| INCLUDE_DIRS "inc"
├── main
│ └── CMakeLists.txt [init point]
|
|- CMakeLists.txt [set(EXTRA_COMPONENT_DIRS components/ZigbeeSDK )]

For your information my project directory looks like attached image,
Above given is just small represantation of my issue so that i can explain you clearly.
Attached CMakelist.txt of platform for better understanding.
Attachments
main_CMakeLists.txt
(678 Bytes) Downloaded 11 times
platform_CMakeLists.txt
(7.48 KiB) Downloaded 7 times
projectCapture.PNG
projectCapture.PNG (21.47 KiB) Viewed 59 times

Who is online

Users browsing this forum: Barkrowler, Bytespider, Google [Bot], Perplexity-User, PerplexityBot, PetalBot and 2 guests