• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: struct編譯正確但卻出現 unable to resolve identifier
#6
初級會員
初級會員


查看用戶資訊
了解了~
感謝你

發表於: 2020/5/28 9:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: struct編譯正確但卻出現 unable to resolve identifier
#5
中級會員
中級會員


查看用戶資訊
bit在PIC是有被宣告的
跟int char unsigned這類的字是一樣的,
所以不能用bit去命名struct

發表於: 2020/5/27 18:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: struct編譯正確但卻出現 unable to resolve identifier
#4
初級會員
初級會員


查看用戶資訊
剛剛看了一下拿來使用的東西打錯了

應該是這樣才對,複製程式後忘了改正
Timer1_Status_flag1.bit.Timer_1ms_Flag 1;


然後剛剛有測試一下把linwangco說的 bit改成bits,還真的很神奇的就不會出現我說的錯誤了。

不過為什麼他會對這個命名方式會做修正呢?
不是我叫什麼名稱應該都可以嗎?

發表於: 2020/5/27 16:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: struct編譯正確但卻出現 unable to resolve identifier
#3
資深會員
資深會員


查看用戶資訊
把bit 改成 bits

應該就可以了吧。

發表於: 2020/5/27 16:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: struct編譯正確但卻出現 unable to resolve identifier
#2
高級會員
高級會員


查看用戶資訊
您好,
可以試試看以下,

volatile union Timer1_Status_Struct
{
struct
{
unsigned int Timer_1ms_Flag : 1;
unsigned int Timer_10ms_Flag : 1;
unsigned int Timer_100ms_Flag : 1;
unsigned int Timer_1s_Flag : 1;
unsigned int UNKNOW5 : 1;
unsigned int UNKNOW6 : 1;
unsigned int UNKNOW7 : 1;
unsigned int UNKNOW8 : 1;
unsigned int UNKNOW9 : 1;
unsigned int UNKNOW10: 1;
unsigned int UNKNOW11: 1;
unsigned int UNKNOW12: 1;
unsigned int UNKNOW13: 1;
unsigned int UNKNOW14: 1;
unsigned int UNKNOW15: 1;
unsigned int UNKNOW16: 1;
} bit;
}Timer1_Status_flag;

Timer1_Status_flag Timer1_Status_flag1 ;
unsigned int IAP_Power_OFF_Flag ;


Timer1_Status_flag1.bit.Timer_1ms_Flag = 1;
IAP_Power_OFF_Flag = Timer1_Status_flag1.bit.Timer_1ms_Flag ;

發表於: 2020/5/27 14:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


struct編譯正確但卻出現 unable to resolve identifier
#1
初級會員
初級會員


查看用戶資訊


想問一下目前用MPLAB X V5.35開一個新專案,在寫struct時編譯正確

volatile union Timer1_Status_Struct

    
struct 
    
{
        
unsigned int Timer_1ms_Flag 1;
        
unsigned int Timer_10ms_Flag 1;
        
unsigned int Timer_100ms_Flag 1;
        
unsigned int Timer_1s_Flag 1;
        
unsigned int UNKNOW5 1;
        
unsigned int UNKNOW6 1;
        
unsigned int UNKNOW7 1;
        
unsigned int UNKNOW8 1;
        
unsigned int UNKNOW9 1;
        
unsigned int UNKNOW101;
        
unsigned int UNKNOW111;
        
unsigned int UNKNOW121;
        
unsigned int UNKNOW131;
        
unsigned int UNKNOW141;
        
unsigned int UNKNOW151;
        
unsigned int UNKNOW161;
    } 
bit;
}
Timer1_Status_flag;


目前編譯成功,但是當我拿來使用時

Timer1_Status_flag.bit.IAP_Power_OFF_Flag 1;


在MPLAB X 就出現了紅底跟相關訊息「unable to resolve identifier」,

而且當我打上Timer1_Status_flag. 並使用Ctrl + \ 他是可以找到bit,

但是Timer1_Status_flag.bit. 並使用Ctrl + \ 他就找不到下其他選項了。

有人知道這邊該如何解決嗎?

發表於: 2020/5/26 16:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------