LPC 1343, Preprocessor '#error' does not pass compilation

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

LPC 1343, Preprocessor '#error' does not pass compilation

370 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lsbach_plum on Mon Mar 12 14:45:29 MST 2012
Hi,

if anyone can use this directive? I have followed the description in the manual (although there could see a '# echo'). So my code looks like:

#if SYSTEM_CORE_CLOCK_24MHz

#error System core clock = 24 MHz

#define SYSTEM_CORE_CLOCK        24000000    //24MHz

#elif ....


thanks
lsbach
0 项奖励
回复
5 回复数

349 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lsbach_plum on Mon Mar 12 23:49:56 MST 2012
thanks for your help
0 项奖励
回复

349 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Mon Mar 12 21:58:30 MST 2012

Quote: lsbach_plum
At what point will appear if I use the directive '# pragma message'?


At the compiler output just like #warning and #error.
0 项奖励
回复

349 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lsbach_plum on Mon Mar 12 21:52:43 MST 2012
I wanted the message appeared in stdrerr. At what point will appear if I use the directive '# pragma message'?
0 项奖励
回复

349 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Mon Mar 12 18:03:21 MST 2012
Please try to explain what you want to do.
Maybe you want something like...

#if SYSTEM_CORE_CLOCK_24MHz

#pragma message "System core clock = 24 MHz"

#define SYSTEM_CORE_CLOCK        24000000    //24MHz

#elif ....
0 项奖励
回复

349 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mdkendall on Mon Mar 12 14:53:43 MST 2012
#error is not supposed to "pass compilation", it is supposed to generate an error; that is the whole point of it. You would use it to trap compile-time problems such as not having defined a required macro, or having defined inconsistent or unsupported values for macros.
0 项奖励
回复