1. 程式人生 > >報錯:multiple definition of 和 first defined here

報錯:multiple definition of 和 first defined here

1、就只有一處定義了全域性變數,但還是報錯,提示重複定義。

2、檢查.h標頭檔案,已經避免重複包含了。

解決方法:

在.c程式中定義全域性變數,在.h檔案中使用extern 做外部宣告,供其他檔案呼叫。

參考連結:
https://blog.csdn.net/mantis_1984/article/details/53571758