Problem mit Funktion in Klasse
-
Header Datei:
#ifndef _KLASSE_ #define _KLASSE_ #include <iostream> #include <string> using namespace std; class AUTO { private: int rad; string name; public: AUTO(): rad(4) {}; //Konstrukor ~AUTO(){}; // Destruktor void ZEIGAuto(); }; //SEMIKOLON NICHT VERGESSEN!!! void ZEIGAuto() { cout << " " << endl; } #endif _KLASSE_CPP Datei:
#include "Klasse.h" int main() { AUTO a; a.ZEIGAuto(); return 0; }Fehler:
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: void __thiscall AUTO::ZEIGAuto(void)" (?ZEIGAuto@AUTO@@QAEXXZ)" in Funktion "_main".
fatal error LNK1120: 1 nicht aufgelöste externe Verweise.Wieso gibt es 1 nicht aufgelösten Verweis?
-
void ZEIGAuto() { cout << " " << endl; }->
void Auto::ZEIGAuto() { cout << " " << endl; }
-
l'abra d'or schrieb:
void ZEIGAuto() { cout << " " << endl; }->
void Auto::ZEIGAuto() { cout << " " << endl; }Passt, danke!
-
AUTO(): rad(4) {}; //Konstrukor ~AUTO(){}; // DestruktorDie Semikolons hinter den geschweiften Klammern sind nicht nötig.