[問題] LNK2019錯誤,但我沒要他連結dll檔

看板C_and_CPP (C/C++)作者 (nimsbnims)時間8年前 (2017/10/20 18:53), 編輯推噓2(2011)
留言13則, 7人參與, 8年前最新討論串1/1
開發平台(Platform): (Ex: Win10, Linux, ...) Win10 編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) VC++2017 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 小弟目前在做學校的Double-Linked List的作業,教授提供框架叫我們把implementation寫出來 之後執行教授提供的測試檔時出現了LNK 2019的錯誤:https://goo.gl/zog1jk 上網查了一下,普遍都是說忘記把該連結的dll檔寫進程式,但我這種簡單的程式根本不會用到任何外來的dll檔案啊QQ 而且我的錯誤訊息後面有亂碼,感覺跟網路上的案例都不太一樣。 想請問有人知道要怎麼解決嗎QQ 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 1>------ 已開始建置: 專案: DoubleLinkedList, 組態: Debug Win32 ------ 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall DList<int>::DList<int>(void)" (??0?$DList@H@@QAE@XZ) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: bool __thiscall DList<int>::isEmpty(void)" (?isEmpty@?$DList@H@@QAE_NXZ) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: int __thiscall DList<int>::length(void)" (?length@?$DList@H@@QAEHXZ) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::insertFront(int const &)" (?insertFront@?$DList@H@@QAEXABH@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::insertBack(int const &)" (?insertBack@?$DList@H@@QAEXABH@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: class DListNode<int> * __thiscall DList<int>::front(void)" (?front@?$DList@H@@QAEPAV?$DListNode@H@@XZ) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: class DListNode<int> * __thiscall DList<int>::back(void)" (?back@?$DList@H@@QAEPAV?$DListNode@H@@XZ) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: class DListNode<int> * __thiscall DList<int>::next(class DListNode<int> *)" (?next@?$DList@H@@QAEPAV?$DListNode@H@@PAV2@@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: class DListNode<int> * __thiscall DList<int>::prev(class DListNode<int> *)" (?prev@?$DList@H@@QAEPAV?$DListNode@H@@PAV2@@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::insertAfter(int const &,class DListNode<int> *)" (?insertAfter@?$DList@H@@QAEXABHPAV?$DListNode@H@@@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::insertBefore(int const &,class DListNode<int> *)" (?insertBefore@?$DList@H@@QAEXABHPAV?$DListNode@H@@@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::remove(class DListNode<int> *)" (?remove@?$DList@H@@QAEXPAV?$DListNode@H@@@Z) 在函式 _main 中被參考 1>DoubleLinkedList.obj : error LNK2019: 無法解析的外部符號 "public: void __thiscall DList<int>::toString(void)" (?toString@?$DList@H@@QAEXXZ) 在函式 _main 中被參考 1>D:\Documents\GoogleDrive.infinite.r06\資料結構作業\HW3\DoubleLinkedList\Debug\DoubleLinkedList.exe : fatal error LNK1120: 13 個無法解析的外部符號 1>專案 "DoubleLinkedList.vcxproj" 建置完成 -- 失敗。 ========== 建置: 0 成功、1 失敗、0 最新、0 略過 ========== 程式碼(Code):(請善用置底文網頁, 記得排版) 程式碼與錯誤訊息:http://goo.gl/pcZ8ao 各檔案大概如下: DList.h.txt:提供double-linked list的控制項 DList.cpp:DList.h的implementation DListNode.h.txt:每個node DListNode.cpp.txt:node的implementation DoubleLinkedList.cpp.txt:測試的主程式碼 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.99 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1508496802.A.DFA.html

10/20 19:06, 8年前 , 1F
甚麼是 DList ?
10/20 19:06, 1F

10/20 19:09, 8年前 , 2F
有template的class宣告和定義不能分開
10/20 19:09, 2F

10/20 19:10, 8年前 , 3F
這週串列週?
10/20 19:10, 3F

10/20 19:18, 8年前 , 4F
可以提供整個專案檔嗎 有可能設定錯誤
10/20 19:18, 4F

10/20 19:22, 8年前 , 5F
推2樓
10/20 19:22, 5F

10/20 20:03, 8年前 , 6F
@longlongint 就是用來指向sentinel和提供node刪減的類
10/20 20:03, 6F

10/20 20:04, 8年前 , 7F
@jerryh001 請問這是什麼意思QQ
10/20 20:04, 7F

10/20 20:04, 8年前 , 8F
@chengcti 好,我放在同一個google資料夾下了
10/20 20:04, 8F

10/20 20:07, 8年前 , 9F
10/20 20:07, 9F

10/20 20:24, 8年前 , 10F
@感謝jerryh001大大,我把所有實作都寫在h就好了Orz
10/20 20:24, 10F

10/21 03:02, 8年前 , 11F
你程式碼連結我點進去叫我跟你拿權限==
10/21 03:02, 11F

10/28 19:07, 8年前 , 12F
抱歉,後來解決了我就把權限關閉了,解決方法後來是直
10/28 19:07, 12F

10/28 19:07, 8年前 , 13F
接把實作都寫入h檔,或是改用codeblock
10/28 19:07, 13F
文章代碼(AID): #1PwTMYtw (C_and_CPP)
文章代碼(AID): #1PwTMYtw (C_and_CPP)