Undefined Reference -> Singleton bei Abstrakter Factory?? oder ganz anderes Problem



  • Nabend

    Ich probier jetzt schon ne Weile, das Abstrakte Factory Pattern zu implementieren.
    Die Factories wollt ich auch als Singleton haben. Nun krieg ich undefined references, und krieg nicht raus wieso.
    Vielleicht ist es auch ein ganz anderes Problem, doch ich blicks grad nicht, drum bitte ich um eure Hilfe.
    Fehlermeldung ist:

    /home/sebi/dev/cpp/lifecycler/src/CLIGraphicFactory.h:14: undefined reference to `CLIGraphicFactory::CLIGraphicFactory()'

    Der Code:

    #ifndef _CLIGRAPHICFACTORY_H_
    #define _CLIGRAPHICFACTORY_H_
    
    #include "GraphicFactory.h"
    
    class CommandDlg;
    
    class CLIGraphicFactory
    : public GraphicFactory
    {
    	public:
    		static GraphicFactory& instance()
    		{
    		    static CLIGraphicFactory graphic_factory;
    		    return graphic_factory;
    		}
    		virtual ~CLIGraphicFactory() {}
    		virtual CommandDlgView* create_cmddlg( const CommandDlg& cmd ) const;
    // weitere create Methoden ausgelassen
    	private:
    		CLIGraphicFactory();
    		CLIGraphicFactory( const CLIGraphicFactory& other );
    		CLIGraphicFactory& operator=( const CLIGraphicFactory& other );
    };
    
    #endif // _CLIGRAPHICFACTORY_H_
    
    #ifndef _GRAPHICFACTORY_H_
    #define _GRAPHICFACTORY_H_
    
    class CommandDlgView;
    class CommandDlg;
    
    class GraphicFactory
    {
    	public:
    		GraphicFactory();
    		virtual ~GraphicFactory() {}
    		virtual CommandDlgView* create_cmddlg( const CommandDlg& cmd ) const = 0;
    // dito
    };
    
    #endif // _GRAPHICFACTORY_H_
    

    Danke euch schonmal im Voraus

    edit: komplettes distclean/rebuild hab ich schon gemacht



  • Hast du CLIGraphicFactory() implementiert?



  • Nein, natürlich nicht 🙄
    *Gegenstirnklatsch*
    Man sollte so spät nicht mehr Coden...

    Danke dir! 👍


Anmelden zum Antworten