lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] std includes


From: timmy brolin
Subject: Re: [lwip-users] std includes
Date: Thu, 14 Jul 2011 00:59:47 -0700

It should work, if lwIP included cc.h before it includes any other files.
Unfortunately, many lwIP files include cc.h after a couple of other .h files.
For example, def.h includes arch.h which includes cc.h, and def.h is not always the first include.

I have tried a couple of include combinations, but the RTOS headers always seems to sneak in before string.h somewhere in lwIP. Difficult to find too, with many headers including other headers in lwIP.
The easiest solution was to make the standard includes the first includes in all lwIP files. I also think it makes some sense to have the standard <string.h> and <stdlib.h> includes at the top of the list of includes before any project specific includes, since project specific includes may be depending on the standard libraries, while the standard libraries will of course never be depending on any project specific includes.

If you prefer to keep the standard includes last in lwIP include lists instead, then that's ok too.
As I said, it is not that big a deal. It is a fairly easy adaptation for me to do when updating lwIP.

Regards,
Timmy Brolin

<-----Ursprungligt Meddelande----->
  From: Simon Goldschmidt address@hidden
Sent: 14/7/2011 9:12:35 AM
To: address@hidden
Subject: Re: [lwip-users] std includes 


Why don't you just include the library files in your cc.h file before including the OS files? That way it should work, too, without having to modify the lwIP sources.

Simon


"timmy brolin" <address@hidden> wrote:

I am using GCC, so nothing too strange there.

The problem is a conflict between some library header files and the RTOS I am using.
The library header files assume that "DEBUG" is defined to "0" or "1" by the IDE.
The RTOS on the other hand works with DEBUG being defined or undefined.

So for example, this inclusion order works:
#include <string.h>
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
....
In the inclusion order above, DEBUG will be defined to 0 or 1 by the IDE, making the libary headers happy. Later the RTOS headers (included from opt.h) will redefine or undefine DEBUG to make the RTOS happy.

But this inclusion order does not work:
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
....
#include <string.h>
....
Because now the RTOS header will have redefined/undefined DEBUG before the library headers are included, and I get compilation errors.

Not a big deal. It is just some extra adaptation work for me when updating lwIP to new version.

Regards,
Timmy Brolin



<-----Ursprungligt Meddelande----->
  From: Andrew Foster [address@hidden]
Sent: 13/7/2011 9:45:17 PM
To: address@hidden
Subject: Re: [lwip-users] std includes 


Tommy,

Just out of curiosity, what compiler are you using?

Are you using an IDE or your own series of make files?

Are you sure you don't have a project/make file error that is causing
your compiler to wig out on the std includes.


Sorry if I'm pointing to things you've already ruled out. My simple mind
tries to rule out the obvious causes first. The source of 99.9% of my
compiler errors are usually found between my keyboard and chair.


Andrew



_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
..

_______________________________________________________________
Hitta ditt drömjobb - Turism Försäljning Vårdjobb Ekonomi Design Bank Media

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________________________
Hitta ditt drömjobb - Turism Försäljning Vårdjobb Ekonomi Design Bank Media


reply via email to

[Prev in Thread] Current Thread [Next in Thread]