comm.h和comm.c是公共模塊。
test1.h和test1.c使用了公共模塊。
test2.h和test2.c使用了了公共模塊。
test.h和test.c使?用了了test1模塊和test2模塊。
這樣最終程序中就會出現兩份comm.h的內容。這樣就造成了了文件內容的重復。
1.方法1
文件開頭加上這一句就ok
#pragma once
2.方法2
將頭文件放在“頭文件”
ifndef __TEST_H__
#define __TEST_H__
//頭文件
#endif //__TEST_H__