找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3220|回復(fù): 5
收起左側(cè)

敬請(qǐng)高手修改“基于STM32F4的電子閱讀器”中的問題,感謝!

[復(fù)制鏈接]
ID:82098 發(fā)表于 2021-4-6 12:17 | 顯示全部樓層 |閱讀模式
敬請(qǐng)高手修改“基于STM32F4的電子閱讀器”中的問題,感謝!

源代碼.7z

842.43 KB, 下載次數(shù): 10

回復(fù)

使用道具 舉報(bào)

ID:328014 發(fā)表于 2021-4-6 14:59 | 顯示全部樓層
貼錯(cuò)誤截圖看看,大家都是手機(jī)上的論壇無法下載編譯
回復(fù)

使用道具 舉報(bào)

ID:82098 發(fā)表于 2021-4-6 15:25 | 顯示全部樓層
compiling main.c...
main.c(253): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "u8 *"
          res=mf_open((char *)spr_name,FA_READ);//只讀打開
main.c(447): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "u8 *"
                          if(mf_open(spr_buf,FA_OPEN_EXISTING)==FR_OK)
main.c(448): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const u8 *"
                                  ai_load_picfile(spr_buf,60,100,150,250,1);        //顯示圖片1
main.c(461): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "u8 *"
                          if(mf_open(spr_buf,FA_OPEN_EXISTING)==FR_OK)
main.c(462): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const u8 *"
                                  ai_load_picfile(spr_buf,280,100,150,250,1);
main.c(477): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "u8 *"
                          if(mf_open(spr_buf,FA_OPEN_EXISTING)==FR_OK)
main.c(478): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const u8 *"
                                  ai_load_picfile(spr_buf,60,450,150,250,1);//顯示圖片3
main.c(492): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "u8 *"
                          if(mf_open(spr_buf,FA_OPEN_EXISTING)==FR_OK)
main.c(493): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const u8 *"
                                  ai_load_picfile(spr_buf,280,450,150,250,1);//顯示圖片4
main.c(702): warning:  #940-D: missing return statement at end of non-void function "lcd_dis_files"
  }
main.c(959): warning:  #170-D: pointer points outside of underlying object
                          if(strncmp(txt_pathname[key-1]-4+strlen(txt_pathname[key-1]),".txt",4)==0)
main.c(1007): warning:  #167-D: argument of type "u8 *" is incompatible with parameter of type "const char *"
                  if(strcmp(path,txt_path_name[ i])==0)
main.c(1007): warning:  #167-D: argument of type "u8 *" is incompatible with parameter of type "const char *"
                  if(strcmp(path,txt_path_name[ i])==0)
main.c(1011): warning:  #167-D: argument of type "u8 *" is incompatible with parameter of type "char *restrict"
                                  strcpy(txt_path_name[j],txt_path_name[j+1]);
main.c(1011): warning:  #167-D: argument of type "u8 *" is incompatible with parameter of type "const char *restrict"
                                  strcpy(txt_path_name[j],txt_path_name[j+1])
回復(fù)

使用道具 舉報(bào)

ID:52586 發(fā)表于 2021-4-7 14:51 | 顯示全部樓層
我編譯了一下 "..\OBJ\HZ.axf" - 0 Error(s), 18 Warning(s) :
沒有錯(cuò)誤,全是警告。 這是原子的代碼嗎? 如果是的話, 寫代碼就有些不負(fù)責(zé)任了,這是教學(xué)用的,要嚴(yán)謹(jǐn)一點(diǎn)。 不能沒錯(cuò)誤就完事了。

function "mf_open" declared implicitly  解決方法: main.c 頭部增加 #include "fattester.h"

然后再編譯, 15個(gè)警告


missing return statement at end of non-void function "lcd_dis_files"   解決方法: lcd_dis_files 函數(shù)最后加上 return 0;

pointer points outside of underlying object   解決方法: 想要沒有警告很簡單, txt_pathname[key-1]-4  這里, 去掉 -4  就可以。
   txt_pathname 是個(gè)字符串?dāng)?shù)組, 這里 txt_pathname[key-1] 是一個(gè)字符串指針, 我不清楚他把一個(gè)指針 -4 是做什么。 需要實(shí)際板子調(diào)試。


剩下的警告,都是形參實(shí)參類型不匹配導(dǎo)致的。 可以用強(qiáng)制類型轉(zhuǎn)換解決。 但最好的辦法是改成統(tǒng)一的定義和調(diào)用, 他這個(gè)代碼像是拼湊起來的。

例如  mf_open((char*)spr_name,FA_READ);   改為  mf_open((u8*)spr_name,FA_READ);  就可以解決。
原因是 mf_open 定義的時(shí)候, 需要 u8* 作為參數(shù), 而調(diào)用的時(shí)候, 給的參數(shù)是  char*, 所以有警告。

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 回帖助人的獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:82098 發(fā)表于 2021-4-8 12:51 | 顯示全部樓層
聆煙雨 發(fā)表于 2021-4-7 14:51
我編譯了一下 "..\OBJ\HZ.axf" - 0 Error(s), 18 Warning(s) :
沒有錯(cuò)誤,全是警告。 這是原子的代碼嗎? ...

感謝回復(fù)!按照你的修改后,還有一些警告怎么解決?敬請(qǐng)回復(fù)!
回復(fù)

使用道具 舉報(bào)

ID:908664 發(fā)表于 2021-4-20 19:09 | 顯示全部樓層
代碼在f429的單片機(jī)里面可以直接用嗎
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表