PIC中实现printf函数出现:Warning [2066] type qualifier mismatch in assignment
来源:互联网 发布:华图直播软件 编辑:程序博客网 时间:2024/05/29 17:11
为什么会出现“Warning [2066] type qualifier mismatch in assignment”(警告[2066] 指定的类型限定符不匹配)?
解答:
MPLAB C18提供的库是使用大代码模型编译(-ml 命令行选项)的。默认情况下,MPLAB IDE和编译器将使用小代码模型编译应用程序。例如,随编译器提供的printf函数期望收到“const far rom char *”,但没有为应用程序选择大代码模型时,应用程序实际发送“const near rom char *”到printf 函数。正是far和near间的差别引起了“type qualifier mismatch in assignment”警告。要消除这些警告,应采取以下三种措施中的一种:
1) 使用小代码模型重新编译随MPLAB C18 提供的库(仅在所有应用程序均使用小代码模型时推荐);
2) 在IDE 中为特定应用程序启用大代码模型(可能会增加代码尺寸);
3) 将常量字符强制转换为常量far rom 字符串指针,如:printf ((const far rom char *)”This is a test\n\r”);
其中2)更改方法如下:
当通过包含stdio.h 使用标准库时,应为项目选择大代码模型。转到Project>Build Options>Project 对话框,并选择MPLAB C18 选项卡,然后选择Categories: Memory Model (类别:存储模型)并选中Large code model (> 64Kbytes) (大代码模型(> 64 KB))。
- PIC中实现printf函数出现:Warning [2066] type qualifier mismatch in assignment
- MDK中问题:warning : type qualifier is meaningless on cast type return 的解决
- pic单片机使用printf函数
- warning: assignment from incompatible pointer type (注册hook时出现了)
- assignment discards ‘const’ qualifier from pointer target type的解决
- warning:initialization discards ‘const’ qualifier from pointer target type 解决方法
- warning: assignment discards qualifiers from pointer target type
- hadoop中mapreduce的 Type mismatch in value from map错误
- 解决编译kernel出现WARNING:Section mismatch(es)
- 使用CodeWarrior出现Warning:Removed dead Code/assignment
- iOS集成环信聊天和EaseUI之后出现警告:Warning! ivar size mismatch in PSUICollectionView_ - can't change the supercl
- argument type mismatch出现的原因,以及解决方法
- 使用oracel 出现 java.lang.IllegalArgumentException: argument type mismatch解决
- 如何在Access中参数化日期类型,以解决Data type mismatch in criteria expression的问题
- hadoop问题Type mismatch in value from map解决方法
- Mapreduce Error: Type mismatch in key from map
- Mapreduce Error: Type mismatch in key from map
- hadoop问题Type mismatch in value from map解决方法
- 淡淡的微笑,静悄悄地过
- android.graphics包下的Matrix 和Camera
- 电脑的启动过程
- 【短讯】基于移动页面的无限轮播javascript类库 - swipeview
- Android在listview添加checkbox实现单选多选操作问题
- PIC中实现printf函数出现:Warning [2066] type qualifier mismatch in assignment
- oracle等待事件5——库高速缓存上的等待事件 中
- Javascript实现浏览器标题栏文字滚动效果
- Struts 2实现文件过滤
- yum 软件包管理器
- Java中的反射机制
- Web.xml 详解
- 一次seq大小和列长度不匹配的问题
- ZendFramework学习第三章(核心组件—ACL高级用法之精细访问控制、移除控制规则)