gcc c error: expected ')' before numeric constant

ElvishPriestley picture ElvishPriestley · Aug 22, 2013 · Viewed 23.6k times · Source

Hi I have been trying to port LWIP to a new arm device. When compiling the code i get the error message:

"lwip/lwip-1.4.0/src/include/lwip/memp_std.h:35:23: error: expected ')' before numeric constant"

When I go to this file this and below this several similar macros is what I find on that line:

LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB,         sizeof(struct raw_pcb),        "RAW_PCB")

If I remove the need for this macro with a define to deactivate the RAW functionality the error moves to the next LWIP_MEMPOL() macro.

The define it seems to want to put a ')' in front of is defined as this:

#define MEMP_NUM_RAW_PCB          1

The RAW_PCB is not defined but is "combined with MEMP_" to create an element in an enum.

I have tried to complie the whole ting with the -E option to get human redable object files and see if i can find any open '(' around the areas where MEMP_RAW_PCB apears and the substitution of MEMP_NUM_RAW_PCB to 1 but I have not found any by manual inspection yet.

Are there any suggestions on what can be going on here or what more I can do or look for to find the cause of the error?

I should maybe add that so far I don't call on any of the LWIP code from main() or any of the functions used in main().

Answer

wii picture wii · Mar 7, 2014

I solved it with:

#ifndef MEMP_STD_H_ 
#define MEMP_STD_H_

... // memp_std.h codes ...

#endif //#ifndef MEMP_STD_H_