How to resolve/suppress error for "static declaration follows non-static declaration" in c ?

nilesh_m
Posts: 13
Joined: Thu Oct 28, 2021 4:12 am

How to resolve/suppress error for "static declaration follows non-static declaration" in c ?

Postby nilesh_m » Tue Jan 11, 2022 4:32 pm

Hi All,

I have below system configuration:
Development Kit: ESP32-Ethernet kit_A_V1.1
Kit version
Module or chip used: ESP32
IDF version :v4.2.1
Build System: Make|CMake|idf.py
Compiler version : xtensa-esp32-elf-gcc (crosstool NCG esp-2020r3)8.4.0
Operating System: Windows
(Windows only) environment type: Command Prompt
Using an IDE?: Yes (Eclipse)


I am trying to integrate Pyramid EIP on ESP32. Pyramid EIP code I have taken as it is from my earlier code, which I was able to build on IAR.
When using same code on ESP32 using esp-idf I am getting one error as,
"static declaration of table follows non-static declaration"

Code: Select all

// In Test.c
static uint8_t table = 0;

in Test.h
extern uint8_t table;
I know it is giving error because we have declared same variable as extern in .h file.
I wanted to know is there a way by which I can suppress this error using any flag or something in CMakeList.txt?

Thanks!!

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: How to resolve/suppress error for "static declaration follows non-static declaration" in c ?

Postby mzimmers » Tue Jan 11, 2022 7:49 pm

If "table" is defined outside of a function, you should be able to remove the "static" keyword from the definition.

nilesh_m
Posts: 13
Joined: Thu Oct 28, 2021 4:12 am

Re: How to resolve/suppress error for "static declaration follows non-static declaration" in c ?

Postby nilesh_m » Wed Jan 12, 2022 4:13 pm

Hi @mzimmers,

Thanks for your quick response.
Sorry, I missed to add in description, due to some limitation I cannot do changes in code.
That is the reason, I was looking for an option by which I can suppress the error.

Now, I found solution as mentioned here
https://github.com/espressif/esp-idf/issues/8225

Thank you for your support!!

Who is online

Users browsing this forum: Gaston1980 and 103 guests