作者ckaha (★閃亮數學推理★)
看板EE_DSnP
標題[問題] 關於 .c 變成.o的問題
時間Wed Mar 5 18:07:09 2008
作業中
a.cpp 需要 include a.h b.h
b.cpp 需要 include b.h
main.cpp 需要 include a.h
那我可以先用
a.cpp + a.h -> a.o
b.cpp + b.h -> b.o
main.cpp -> main.o
然後將他們再一起組合成一個執行檔
因為我是這樣想的
不管如何包含a.h b.h
終究我都會把他們三個兜在一起
所以程式執行的時候他都找的到
這樣想可以嗎?
還是哪裡有錯呢?
--
Every thing can be w
rong unless you can proof it is
true.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.4.235
1F:推 timrau:Without including a.h, how could the compiler know what 03/05 18:48
2F:→ timrau:"class A" mean? 03/05 18:48