未完成的基本ctor外部

时间:2015-06-25 22:21:51

标签: c++

我不明白我做错了什么。似乎代码是基本的:

NeuralNetSettings.h文件:

class NeuralNetSettings
{
private:
    int mNumInputs;
    int mNumOutputs;
    int mNumHidden;
    int mNumNeuronsPerHidden;

public:
    NeuralNetSettings();

    int getNumInputs() const { return mNumInputs; }

    int getNumOutputs() const { return mNumOutputs; }

    int getNumHidden() const { return mNumHidden; }

    int getNumNeuronsPerHidden() const { return mNumNeuronsPerHidden; }
};

NeuralNetSettings.cpp:

#include "NeuralNetSettings.h"

NeuralNetSettings::NeuralNetSettings() :
    mNumInputs(0),
    mNumOutputs(0),
    mNumHidden(0),
    mNumNeuronsPerHidden(0) {
}

主要功能:

#include "NeuralNetSettings.h"

int main() {
    NeuralNetSettings s;

    return 0;
}

编译错误:

  

错误1错误LNK2019:未解析的外部符号" public:__ thishisall   NeuralNetSettings :: NeuralNetSettings(无效)"   (?? 0NeuralNetSettings @@ QAE @ XZ)在函数中引用   _main C:... \ Source.obj NNTester

这是怎么回事?我是否应该永远不要使用.cpp文件,因为它们似乎比它们值得更麻烦?

0 个答案:

没有答案