0
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
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by heidik
0

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;
		}
	};
0

You have

Breach();

But have no body for your default constructor.

Try

Breach() {}

Edited by gerard4143: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.