[gtkmm] static Glib::RefPtr<>'s



I'm trying to create a singleton class to use for a variable that's a
RefPtr<>.  It compiles, but fails to link when used.  Are there any
problems with using a static RefPtr<> in this way?  The code isn't very
long, so I have pasted it below.  Any tips would be much appreciated:

FILE:  Glade.h

#ifndef GLADE_H
#define GLADE_H

#include <glibmm.h>
#include <libglademm.h>

class Glade {

	public:
		static Glib::RefPtr<Gnome::Glade::Xml> get();

	protected:
		Glade();
		Glade(const Glib::RefPtr<Gnome::Glade::Xml>&);
		Glade& operator= (const
 				 Glib::RefPtr<Gnome::Glade::Xml>&);

	private:
		static Glib::RefPtr<Gnome::Glade::Xml> instance;
};

#endif

FILE:  Glade.cc

#include "Glade.h"

Glib::RefPtr<Gnome::Glade::Xml> Glade::get() {
	
	if (instance)
		instance = Gnome::Glade::Xml::create("glade/k5.glade");

	return instance;
}

Glade::Glade() { }


-- 
Jay Camp <jayc clemson edu>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]