找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2451|回复: 5
打印 上一主题 下一主题
收起左侧

敬请高手修改“基于STM32F4的电子阅读器”中的问题,感谢!

[复制链接]
跳转到指定楼层
楼主
ID:82098 发表于 2021-4-6 12:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
敬请高手修改“基于STM32F4的电子阅读器”中的问题,感谢!

源代码.7z

842.43 KB, 下载次数: 8

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:328014 发表于 2021-4-6 14:59 | 只看该作者
贴错误截图看看,大家都是手机上的论坛无法下载编译
回复

使用道具 举报

板凳
ID:82098 发表于 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])
回复

使用道具 举报

地板
ID:52586 发表于 2021-4-7 14:51 | 只看该作者
我编译了一下 "..\OBJ\HZ.axf" - 0 Error(s), 18 Warning(s) :
没有错误,全是警告。 这是原子的代码吗? 如果是的话, 写代码就有些不负责任了,这是教学用的,要严谨一点。 不能没错误就完事了。

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

然后再编译, 15个警告


missing return statement at end of non-void function "lcd_dis_files"   解决方法: lcd_dis_files 函数最后加上 return 0;

pointer points outside of underlying object   解决方法: 想要没有警告很简单, txt_pathname[key-1]-4  这里, 去掉 -4  就可以。
   txt_pathname 是个字符串数组, 这里 txt_pathname[key-1] 是一个字符串指针, 我不清楚他把一个指针 -4 是做什么。 需要实际板子调试。


剩下的警告,都是形参实参类型不匹配导致的。 可以用强制类型转换解决。 但最好的办法是改成统一的定义和调用, 他这个代码像是拼凑起来的。

例如  mf_open((char*)spr_name,FA_READ);   改为  mf_open((u8*)spr_name,FA_READ);  就可以解决。
原因是 mf_open 定义的时候, 需要 u8* 作为参数, 而调用的时候, 给的参数是  char*, 所以有警告。

评分

参与人数 1黑币 +50 收起 理由
admin + 50 回帖助人的奖励!

查看全部评分

回复

使用道具 举报

5#
ID:82098 发表于 2021-4-8 12:51 | 只看该作者
聆烟雨 发表于 2021-4-7 14:51
我编译了一下 "..\OBJ\HZ.axf" - 0 Error(s), 18 Warning(s) :
没有错误,全是警告。 这是原子的代码吗? ...

感谢回复!按照你的修改后,还有一些警告怎么解决?敬请回复!
回复

使用道具 举报

6#
ID:908664 发表于 2021-4-20 19:09 | 只看该作者
代码在f429的单片机里面可以直接用吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表