C语言提示multiple definition of displayPC以为是重复定义 ,实际原因是变量在头文件中不能初始化

 
在a.h头文件中定义变量temp并初始化,即显式初始化。int temp = 0;

a.c b.c文件中都包含了a.h头文件,则在编译时会出现:multiple definition of `temp’的错误。

猜你喜欢

转载自blog.csdn.net/chenhao0568/article/details/106844039