Re: C++ program compiliation failed

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



On 11/15/2010 10:17 PM, Magnus Therning wrote:
On Mon, Nov 15, 2010 at 13:00, Nilesh Govindarajan<lists@xxxxxxxxxx>  wrote:
On 11/14/2010 11:29 PM, Nilesh Govindarajan wrote:

Hi,
I have three c++ files: main.cpp, and querystring.{h,cpp}


Guys, thanks for your suggestion, but the problem turned out to be inline
constructor. I don't know why that doesn't work (it's as per ANSI though).

I'm sure actual examples would have helped here :-)

/M


So here it is:

class QueryString {

private:
 const string __qstr;
public:
 QueryString() {
  throw Exception("Invalid constructor"); // defined in Exception.h
 }

 QueryString(const char* s) : __qstr(s) {}
 QueryString(const string& s): __qstr(s) {}
 http_map* parse();

};

PS: The default constructor is pretty dumb logic, I'll be changing that :)

This doesn't compile on my box, saying `undefined reference to QueryString::QueryString()' or any other constructor.

It doesn't matter if I define it inside (therefore implicitly inline as per ANSI) or outside using the inline keyword, it still won't compile (at least on my arch64).

--
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com
VPS Hosting: http://www.itech7.com/a/vps


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux