错误LNK2019和错误LNK1120

时间:2014-08-07 08:36:44

标签: c++

//opgave 8.6.1(1)
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "krypto.h"
#include "krypto.h"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    krypto data;

    cout << "skriv her:";
    data.hentdata();

system("pause");
return 0;
}






//Krypto.h
#pragma once
class krypto
{
public:
    krypto();
    void hentdata();
private:
    char data;
};





//krypto.cpp
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "krypto.h"
using namespace std;

krypto::krypto()
{
}

void hentinput(){
    char data;

    cout << "Skriv dit input: ";
    cin >> data;
    cout << data;
    }

我找不到错误!任何人都可以帮忙吗?

错误1错误LNK2019:未解析的外部符号“public:void __thiscall krypto :: hentdata(void)”(?hentdata @ krypto @@ QAEXXZ)在函数_wmain中引用C:\ Users \ LAB \ Documents \ steffen \ c ++ opgaver \ bogen \ opgave 8.6.3(1)\ opgave 8.6.3(1)\ opgave 8.6.3(1).obj opgave 8.6.3(1)

错误2错误LNK1120:1未解析的外部C:\ Users \ LAB \ Documents \ steffen \ c ++ opgaver \ bogen \ opgave 8.6.3(1)\ Debug \ opgave 8.6.3(1).exe 1 1 opgave 8.6.3( 1)错误2

1 个答案:

答案 0 :(得分:0)

改变这个:

void hentinput()
{
    char data;
    ...
}

对此:

void krypto::hentdata()
{
    ...
}
相关问题