By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,942 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

problems with the constructor

P: 1

First of all, perdon for my English. I don't express the thinks very good.

Well, I'm working with eclipse 3.1.1, wxWidgets 2.4.2, MSYS 1.0.10 and Mingw 3.1.0. I'm doing a project in c++. I've got problems with one library, the compiler don't accept the multiply definition of the constructor. The compiler give me errors in the lines of the constructor definition. But it don't anything about what happends withs this lines.

Anybody can help me?? I don't know if I have to compile the project with a specific parameter.

The code is this:

#ifndef INCLUDED_BehaviorBase_h_
#define INCLUDED_BehaviorBase_h_

#include "Events/EventListener.h"
#include "Shared/ReferenceCounter.h"
#include <string>
#include <set>

class BehaviorBase : public ReferenceCounter, public EventListener {
//! destructor - if is active when deleted, will display a warning (don't delete directly - use RemoveReference())
virtual ~BehaviorBase();

virtual void DoStart();
virtual void DoStop();

virtual void processEvent(const EventBase& /*event*/) {}

//! Identifies the behavior in menus and such
virtual std::string getName() const { return instanceName; }

//! Allows dynamic renaming of behaviors
virtual void setName(const std::string& name) { instanceName=name; }

virtual std::string getDescription() const {
std::string d=getClassDescription();
return (d.size()==0)?getName():d;

virtual std::string getClassName() const { return className; }

static std::string getClassDescription() { return ""; }

//! Returns true if the behavior is currently running
virtual bool isActive() const { return started; }

static const std::set<BehaviorBase*>& getRegistry() { return registry; }

//! constructor, @a name is used as both instance name and class name
explicit BehaviorBase(const std::string& name);
//! constructor, allows different initial values for class name and instance name
BehaviorBase(const std::string& classname, const std::string&
//! copy constructor; assumes subclass handles copying approriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
BehaviorBase(const BehaviorBase& b);
//! assignment operator; assumes subclass handles assignment appropriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
BehaviorBase& operator=(const BehaviorBase& b);

bool started; //!< true when the behavior is active
std::string instanceName; //!< holds the name of this instance of behavior
const std::string className; //!< holds the type of the subclass of this behavior as a string
static std::set<BehaviorBase*> registry; //!< allows us to keep track of all the current behaviors

Jul 9 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.