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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

821件の閲覧回数
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 返答(返信)

800件の閲覧回数
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 件の賞賛
返信

800件の閲覧回数
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 件の賞賛
返信

800件の閲覧回数
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 件の賞賛
返信

800件の閲覧回数
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 件の賞賛
返信

800件の閲覧回数
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 件の賞賛
返信