[Code Composer Studio] 使用C I/O函数必须包含stdio.h


造冰箱的大熊猫,适用于Code Composer Studio v3.3@cnblogs 2021/5/29

1、问题描述

1)main.c包括main()func()func()中调用了sscanf()main.c#inclulde 。编译通过,运行正常。

2)将func()的代码移入user.c,在user.h中添加了func()的声明,在main.c中#include "common.h"。编译通过,运行时发现sscanf()读取的数据不对,通过仿真器发现sscanf()输入的字符串正确,但读取到的数据完全不对。

2、问题解决

user.h中添加#include 。重新便于,运行正常。

3、问题原因

任何调用C I/O函数的模块都必须#inclulde ,参见下图(截取自Tips for Using Printf @ Texas Instruments)。