breachmonitor.cpp:(.text+0x17ce): undefined reference to `BreachMonitor::Breach::Breach()'

Can anyone please tell me what does it mean? I have created a struct and then declared its variable like

Breach wb;

and it isnt compiling. The structure has default constructor (no arguments) and another one for initialization. It has also got two methods.

bool operator==(const Breach& p) const
bool operator<(const Breach& p) const

Can we see your structure/class?

Actually it is my office work and I am afraid I wont be able to send the class but do you have any idea of what the problem could be.

struct Breach
	{
		  string trdr;        /*!< Trader itm */
		  string sendt;       /*!< Time of message transmission */  
		  string com;         /*!< Commodity */
		  
		Breach();

		Breach(const std::string& _trdr, const std::string& _sendt, const std::string& _com): trdr(_trdr), sendt(_sendt), com(_com) {}
	
		bool operator==(const Breach& p) const
		{
			return trdr == p.trdr && com == p.com;
		}

		bool operator<(const Breach& p) const
		{
			if(trdr < p.trdr) return true;
			if(trdr > p.trdr) return false;
			if(com < p.com) return true;
			if(com > p.com) return false;	

			return false;
		}
	};

You have

Breach();

But have no body for your default constructor.

Try

Breach() {}

Thanks it worked :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.