我試圖在C++中創建對象數組,但我得到了一些奇怪的錯誤,我不知道爲什麼。一些錯誤,當我嘗試創建obejct數組
Complex ** tab; //class field
matrix::matrix(int x, int y) //construktor
{
tab = new Complex * [x];
for (int i = 0; i < x; i ++)
{
tab[i] = new Complex[y];
}
的錯誤是:
1> matrix.obj:錯誤LNK2019:解析外部符號 「公共:__thiscall複雜::絡合物(無效)」(?? 0Complex @@ @ QAE XZ)引用在公共函數「public:__thiscall矩陣::矩陣(int,int)」(?? 0矩陣@@ QAE @ HH @ Z)
1> matrix.obj:error LNK2019:無法解析的外部符號「public:__thiscall Complex: :函數「public:__thiscall matrix :: matrix(int,int)」中引用的「〜Complex(void)」(?? 1Complex @@ QAE @ XZ)
有什麼不對?
[見這個問題](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-修復),也許[這個答案](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-doi-i-fix/12574407 #12574407)或[this one](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574400 #12574400)。 – chris
某種奇怪的評論。 –