cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone else had issues with DEFINES in LWIP not working right?

MStra.3
Associate III

So I have run into this a couple of times. Right now I have one that I cannot find a good fix for.

I set SNTP_GET_SERVERS_FROM_DHCP to 1 in CubeMX and generated the project then compiled. It is correctly set in lwipopts.h but in sntp.h and sntp.c it acts as if it is set to zero!

sntp.c has sntp.h and lwip/opt.h included in it.

sntp.h has sntp_opts.h included in it.

sntp_opts.h has lwip/opt.h included in it.

lwip/opt.h has lwipopts.h included in it.

So there's a bunch of nesting of includes and it seems that lwip/opt.h is duplicated in the path to sntp.c.

This seems like an issue with how lwip is set up or a compiler issue... I'm not an expert on this stuff. Anyone have ideas?

Mike.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Defines are handled by the GNU GCC preprocessor, which is an extremely commonly used software and is unlikely to have glaring bugs in the #define handling.

Duplicated include files are generally fine as there should be include guards or a #pragma once to prevent it from being included multiple times.

> in sntp.h and sntp.c it acts as if it is set to zero!

How did you determine this exactly?

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Defines are handled by the GNU GCC preprocessor, which is an extremely commonly used software and is unlikely to have glaring bugs in the #define handling.

Duplicated include files are generally fine as there should be include guards or a #pragma once to prevent it from being included multiple times.

> in sntp.h and sntp.c it acts as if it is set to zero!

How did you determine this exactly?

If you feel a post has answered your question, please click "Accept as Solution".
MStra.3
Associate III

OK, turns out there was another Define I needed to SET that was resetting the one I was chasing...

Thanks for your reply!

Mike.