欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標(biāo)題: error: declaration may not appear after executable statement in block [打印本頁(yè)]

作者: niujia    時(shí)間: 2015-7-17 16:51
標(biāo)題: error: declaration may not appear after executable statement in block


這個(gè)問(wèn)題是在編譯STM32的程序時(shí)遇到的,這個(gè)錯(cuò)誤的原因是對(duì)于變量的聲明不能放在可執(zhí)行語(yǔ)句后面,必須在主函數(shù)開(kāi)頭聲明變量。在程序中聲明一個(gè)變量時(shí),需要在可執(zhí)行語(yǔ)句之前聲明,否則會(huì)出現(xiàn)以上錯(cuò)誤。

例:

vu16 KeyPortState=0;
SystemInit();   

KeyScanState_Typedef KeyScanState=KeyScanState_0; //KeyScanState_Typedef 為作者自定義的結(jié)構(gòu)體
GPIO_Configuration();     

以上編譯會(huì)出項(xiàng)錯(cuò)誤,原因是KeyScanState_Typedef KeyScanState=KeyScanState_0; 出現(xiàn)在SystemInit();之后。

正確的函數(shù)語(yǔ)句段是:

vu16 KeyPortState=0;

KeyScanState_Typedef KeyScanState=KeyScanState_0;
SystemInit();
GPIO_Configuration();







歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1