討論串[問題] Link Error : Already Defined in main …
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者QQ29 (我愛阿蓉)時間16年前 (2009/08/01 11:11), 編輯資訊
0
0
0
內容預覽:
^^^^^^^^^^^^^^. 好習慣 .h只要寫宣告就好 而你這邊 寫這樣 就是定義. 把這行擺到a.cpp 即可. 會出現這error跟 ifndef有沒有寫無關. 你從main.cpp 開始想 include a.h 就貼了一次A::a=5近來cpp了. 然後A.cpp include a.h
(還有21個字)

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者realmojo (YOYO)時間16年前 (2009/08/01 10:01), 編輯資訊
0
0
0
內容預覽:
=== A.h ===. #ifndef A_H. #define A_H. class A. {. static int a;. };. int A::a = 5;. #endif. ==A.cpp===. #include "A.h". ==main.cpp==. #include "A.h".
(還有116個字)
首頁
上一頁
1
下一頁
尾頁