使用標頭檔問題 |
尚未結案
|
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
各位先進: 小弟是要練習繼承的用法
想說大概可以在同一個資料夾下讀到 .h 檔應該就沒有問題
結果小弟只是把 class 寫在 .h 檔下
把 constructor 及 class function 寫在 .cpp 檔下
連繼承都還沒開始,只是呼叫 class 來用測試而已 compile 的時候會出現:
unresolved external myclass::myclass(int ,int) referenced from
objpath / UNITOBJ 小弟用 C Builder 的 console mode 來測試應該沒錯吧?
因為在 VC 下測試沒有問題,是不是小弟沒注意到什麼呢?
還是小弟應該用別的 mode 來開啟呀? 感謝回答
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
流您好:
方便將.h以及.cpp 程式碼PO上來嗎?
好讓有經驗的人可以幫您看看
我用下面code測試可行
//Unit1.cpp #pragma hdrstop #include順心 發表人 - |
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
taishyang 您好:
myclass.h 內容如下: # ifndef MYCLASS_H # define MYCLASS_H # include發表人 - 流 於 2003/12/17 22:40:43 |
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
taishyang 您好: 對呀,就是這樣分開的
但說出來您可能不相信!
用您上傳的檔案來 compile 出現一樣的錯誤 QQ 選檔的步驟是: [File] → [Open] → unit.cpp ,再 compile
應該不會是沒註冊或沒 update 造成的吧? 如果選檔的步驟是: [File] → [Open] → Project2.bpr ,再 compile
會出現...[Linker Fatal Error] Fatal: Unable to open file 'RZ30CTLS60.BPI' 感謝回答
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
流您好:
引言: 選檔的步驟是: [File] → [Open] → unit.cpp ,再 compile 應該不會是沒註冊或沒 update 造成的吧? 如果選檔的步驟是: [File] → [Open] → Project2.bpr ,再 compile 會出現...[Linker Fatal Error] Fatal: Unable to open file 'RZ30CTLS60.BPI'抱歉請重新下載,並利用您說的第二個步驟選檔 [File] → [Open] → Project2.bpr ,再 compile 個人疏失造成您的困擾請見諒 |
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
taishyang 您好: 先讓小弟感謝您,您每次都很熱心的幫忙小弟! 不過這次還是不行,依第二個步驟,compile出現一樣的錯誤
其實是先出現一個對話框,內容寫著 Unable to find package import : Rz30Ctls60.bpi
按了好幾下 cencel 後才出現
[Linker Fatal Error] Fatal: Unable to open file 'RZ30CTLS60.BPI'
依第一個步驟的話,是先出現一個 MessabeBox,內容如下:
would you like to create a project so this file can compile and run ? 小弟也有試過把您檔案中的 myclass.h 及 myclass.cpp 複製到一個資料夾下
開一個 unit1.cpp 檔 ,再 include "myclass.h" 進來,但依然出現錯誤
就是兩個 unresolved external 的錯誤 再一次感謝,謝謝您
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
流您好:
我只能說真是太神奇了
我下載到學弟的電腦也是可以 >
<>< face="Verdana, Arial, Helvetica">引言:
其實是先出現一個對話框,內容寫著 Unable to find package import : Rz30Ctls60.bpi
按了好幾下 cencel 後才出現
[Linker Fatal Error] Fatal: Unable to open file 'RZ30CTLS60.BPI'
您可以在專案設定中的Include以及Lib Path將不必要的路徑給刪除
應該可以解決 順心 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~>
|
流
中階會員 發表:36 回覆:142 積分:70 註冊:2003-07-24 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |