Page 1 of 1

Getting ": undefined reference to " error in project directory

Posted: Fri Jul 04, 2025 7:08 am
by kesha.modhia
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

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

Posted: Fri Jul 04, 2025 11:27 am
by MicroController
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.

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

Posted: Mon Jul 07, 2025 9:35 am
by kesha.modhia
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.