VC++ 2010错误LNK2019:未解析的外部符号

Jaa*_*nus 1 c++ visual-studio-2010 visual-studio visual-c++

主cpp文件:

#include <iostream>
#include <cstdio>

#include "table.h"

using namespace std;

int main() {

    Table test;

    int i;
    for(i = 0; i < 26; i++) {
        cout << test.start[2] << endl;
    }

    system("PAUSE");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

头文件:

#pragma once


class Table {
    public:
        char start[26];

        Table();
        Table(char key[26]);

        ~Table();
};
Run Code Online (Sandbox Code Playgroud)

cpp文件:

#include "table.h"


Table::Table() {
    char start[26] = "ABCDEFGHIJKLMNOPRSTUVWXYZ";
}

Table::Table(char key[26]) {

}
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

1>playfair.obj : error LNK2019: unresolved external symbol "public: __thiscall Table::~Table(void)" (??1Table@@QAE@XZ) referenced in function _main

1>c:\Users\Jansu\Documents\Visual Studio 2010\Projects\playfair\Debug\playfair.exe : fatal error LNK1120: 1 unresolved externals
Run Code Online (Sandbox Code Playgroud)

所以基本上我google了很多,不知道该怎么做.我找到了一些答案,但我尝试了它们并没有帮助

例如,我试图添加其他依赖项,但我已经添加了所有这些依赖项.

请帮帮我,为什么错误来了?

Ced*_*sme 6

您必须在cpp文件中定义析构函数:

Table::~Table()
{

}
Run Code Online (Sandbox Code Playgroud)