fehler im construktor?



  • Moinsen,

    ich hab hier folgendes Codefragment, welches sich nicht compilieren lässt:

    ############################################
     parser.h
    ############################################
    
    #include <string>
    
    class parser
    {
    
    public:
        // C/D-Toren
        parser();
        parser(const parser& p);
        ~parser();
    
        // evtl. Operatoren?
    
        // Parser-Funktionen
        void add(const std::string& stream_of_octets);
    
    private:
        std::string stream_of_octets;   // hält die empfangenen Daten
    
    } // class parser
    
    ############################################
     parser.cpp
    ############################################
    
    #include "parser.h"
    
    /*********************************************************************************
     * C/D-Toren
     *********************************************************************************/
    parser::parser() 
    {
        stream_of_octets = "";
    }
    
    parser::parser(const parser& p) 
    {
        this->stream_of_octets = p.stream_of_octets;
    }
    
    parser::~parser() 
    {
        stream_of_octets = "";  
    }
    
    /*********************************************************************************
     * Parser-Funktionen
     *********************************************************************************/
    void parser::add(const std::string& stream_of_octets)
    {
        this->stream_of_octets += stream_of_octets;  
    }
    

    Folgende Fehlermeldung kommt, wenn ich es mit dem bcc32-Kommandozeilencompiler kompilieren möchte:

    Error E2111 parser.cpp 7: Type 'parser' may not be defined here
    Error E2136 parser.cpp 7: Constructor cannot have a return type specification
    *** 2 errors in Compile ***
    

    Ich such jetzt schon seit ner Stunde und komm nicht drauf 😞 hat jemand nen Tipp für mich?

    Danke schonmal

    Beechen



  • Da fehlt ein Semikolon hinter der Klassen-Deklaration.



  • urgs *ggg* -- danke dir ;)))

    Beechen


Anmelden zum Antworten