错误LNK2019:未解析的外部符号,使用多重继承

时间:2015-04-16 16:56:01

标签: c++ visual-studio-2013 lnk2019

拜托,有人可以帮我完成作业吗?这是学习如何使用Multiple Inherritance的非常基础的程序。

我得到的错误是:

Error   1   error LNK2019: unresolved external symbol "public: void __thiscall Wasmachine::wassen(void)" (?wassen@Wasmachine@@QAEXXZ) referenced in function "public: void __thiscall Automaat::start(void)" (?start@Automaat@@QAEXXZ)  C:\Users\Gebruiker\Documents\Visual Studio 2013\Projects\C++ Eindopdracht\C++ Eindopdracht\Automaat.obj C++ Eindopdracht
Error   2   error LNK2019: unresolved external symbol "public: void __thiscall Centrifuge::centrifugeren(void)" (?centrifugeren@Centrifuge@@QAEXXZ) referenced in function "public: void __thiscall Automaat::start(void)" (?start@Automaat@@QAEXXZ)    C:\Users\Gebruiker\Documents\Visual Studio 2013\Projects\C++ Eindopdracht\C++ Eindopdracht\Automaat.obj C++ Eindopdracht
Error   3   error LNK1120: 2 unresolved externals   C:\Users\Gebruiker\Documents\Visual Studio 2013\Projects\C++ Eindopdracht\Debug\C++ Eindopdracht.exe    1   1   C++ Eindopdracht

Automaat.h:

#ifndef AUTOMAAT_H
#define AUTOMAAT_H

#include "Wasmachine.h"
#include "Centrifuge.h"

class Automaat : public Wasmachine, public Centrifuge {
public:
    void start();
};

#endif

Wasmachine.h:

#ifndef WASMACHINE_H
#define WASMACHINE_H

#include "cfunctions.h"

class Wasmachine {
public:
    Wasmachine() { //constructor
        char machine[24][31] = { // some information I want to display };

        for (int m = 0; m<24; m++){
            gotoxy(29, 5 + m);
            cout << machine[m];
        }
    }

    ~Wasmachine() {
        normale_cursor();
    }

    void wassen();
};

#endif

centrifuge.h:

#ifndef CENTRIFUGE_H
#define CENTRIFUGE_H

class Centrifuge {
public:
    void centrifugeren();                       
};

#endif

Automaat.cpp:

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

#include "Automaat.h"

void Automaat::start(){
    char ch = getc(stdin);
    if (ch == 's' || ch == 'S') {
        wassen(); // from "Wasmachine.h"
        centrifugeren(); // from "Centrifuge.h"
    }
}

void main() {
    Automaat a;
    a.start();
}

提前谢谢!

0 个答案:

没有答案