Library reports error: __use_no_semihosting was requested, but _ttywrch was referenced** 出现这个原因是KEIL没有勾选 Use MicroLIB,勾选即可 error: #268: declaration may not appear after executable statement in block(声明不能出现在块中的可执行语句之后 ) error: #5: cannot open source input file “core_cm4.h”: No such file or directory |
也可以不选用microlib,通过添加以下代码: //加入以下代码,支持printf函数,而不需要选择use MicroLIB pragma import(__use_no_semihosting) //标准库需要的支持函数 struct __FILE { int handle; }; FILE __stdout; //定义_sys_exit()以避免使用半主机模式 void _sys_exit(int x) { x = x; }
这个分享可以,多多分享哈