1. 程式人生 > >無法解析的外部符號 "public: __thiscall SeqStack<int>::~SeqStack<int>(void)" (

無法解析的外部符號 "public: __thiscall SeqStack<int>::~SeqStack<int>(void)" (

當我們在寫類的時候,就離不開解構函式。

當出現“    2    error LNK2019: 無法解析的外部符號 "public: __thiscall SeqStack<int>::~SeqStack<int>(void)" ([email protected]@@[email protected]),該符號在函式 _main 中被引用”

說明我們的解構函式在_main中被引用,程式也會出錯,無法執行。原因就是解構函式寫成~seqstack(),這種寫法是錯誤的,即使解構函式沒有任何的操作,但也應寫成~seqstack(){}。

這是我們語言程式設計的規則