warning: declaration does not declare anything

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

warning: declaration does not declare anything

2,113 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Fri Jul 20 20:14:38 MST 2012
Man I hate tool-chain errors, give me an honest code bug any day.

I've been writing a stack of code for a week or so now and it's be going just fine. This morning I thought it's time to turn it into a library to clean things up so I created a new project, sucked all the files into it and tried to build.

Now I get a dozen or so warnings in LPC122x.h when building the CMSISv2p00_LPC12xx project


Quote:
warning: declaration does not declare anything

It's referring to any use of unions inside the structs that define peripherals, eg

typedef struct {                            /*!< (@ 0x4000C000) UART1 Structure        */
  
  union {
    __IO uint32_t DLL;                      /*!< (@ 0x4000C000) Divisor Latch LSB. Least significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider. */
    __IO uint32_t THR;                      /*!< (@ 0x4000C000) Transmit Holding Register. The next character to be transmitted is written here. */
    __I  uint32_t RBR;                      /*!< (@ 0x4000C000) Receiver Buffer Register. Contains the next received character to be read. */
  };
   ...
} LPC_UART1_Type;
So things like TDR don't get defined and of course further down in my project I get


Quote:
has no member named 'THR'

style errors.

I thought it may be the C variant but I'm using C99 as I always have and I can see no obvious option that would do this. I cleaned both projects in case there was a dodgy .a file somewhere, no difference.

Any ideas?
0 项奖励
回复
1 回复

1,883 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Sat Jul 21 02:34:58 MST 2012
OK, stop looking I think I found it. Despite having done this before it seems that  selecting gnu99 fixes the problem.

Change back to c99...problem back.

And yet I've been using c99 up till now.
0 项奖励
回复