[arch-general] C++ program compiliation failed
Nilesh Govindarajan
lists at itech7.com
Tue Nov 16 14:38:09 CET 2010
On 11/15/2010 10:17 PM, Magnus Therning wrote:
> On Mon, Nov 15, 2010 at 13:00, Nilesh Govindarajan<lists at itech7.com> 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
More information about the arch-general
mailing list