Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 11, 2007 Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
I'm trying to make a custom Exception class with this : class MyException : Exception { static char[] s = "My Exception"; this() { super(s); } char[] toString() { return s; } } it compile well, until I want to throw it :/ When I put the line : throw new MyException(); I get that error : webcache.obj(webcache) Error 42: Symbol Undefined _D4util10linkedlist13TestException7__ClassZ webcache.obj(webcache) Error 42: Symbol Undefined _D4util10linkedlist13TestException5_ctorMFAaZC4util10linkedlist13TestException --- errorlevel 2 The two class ( Exception and thrower class ) are in the same file. I tried Copy / Past examples from the site, but it still donc work. An idea ? |
May 11, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vermi | Reply to Vermi, [...] can you post a minimal test case? |
May 11, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | The code I join don't work, but I tried just copy, past and rename de LinkedList class to LinkedListTestException, and it worked. The Exception is thrown in the get function of the LinkedList class (it's an OutOfBoundsException). Hope you will find what I missed ^^ |
May 11, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vermi | "Vermi" <aurelien.vermifuge@gmail.com> wrote in message news:f22d6l$tfi$1@digitalmars.com... > I'm trying to make a custom Exception class with this : > > > class MyException : Exception > { > static char[] s = "My Exception"; > this() > { > super(s); > } > > char[] toString() > { > return s; > } > } <snip> Any particular reason you're overriding toString to do exactly what it already does? Stewart. |
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | It was just a try, but deleting the toString function don't change my problem :/
I think the linker cannot find the modules because there are not in it's include path. I will try to compile all the files simultaneously in a single line.
The problem is not present when I don't use modules.
I saw phobos has a .a file in the lib directory, should my modules have one too ?
sorry for my english.
Vermi
Stewart Gordon Wrote:
> "Vermi" <aurelien.vermifuge@gmail.com> wrote in message news:f22d6l$tfi$1@digitalmars.com...
> > I'm trying to make a custom Exception class with this :
> >
> >
> > class MyException : Exception
> > {
> > static char[] s = "My Exception";
> > this()
> > {
> > super(s);
> > }
> >
> > char[] toString()
> > {
> > return s;
> > }
> > }
> <snip>
>
> Any particular reason you're overriding toString to do exactly what it already does?
>
> Stewart.
>
|
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vermi | Reply to Vermi, > > I saw phobos has a .a file in the lib directory, should my modules > have one too ? > That is a lib file for linux, you shouldn't need to make a lib file of your own. > sorry for my english. Why is it that only the forever who have good English apologies for it? :b |
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote:
> Reply to Vermi,
>
>>
>> I saw phobos has a .a file in the lib directory, should my modules
>> have one too ?
>>
>
> That is a lib file for linux, you shouldn't need to make a lib file of your own.
>
>> sorry for my english.
>
> Why is it that only the forever who have good English apologies for it? :b
>
I've often wondered. In fact, one of my personal friends with the best command of the language is a Netherlander. (Sure their language isn't as far off, but still.) I think the common -- albeit accurate -- axiom of "English is the hardest language to learn" makes them more self-conscious, perhaps? Somebody set us up the bomb. All your base are belong to us.
-- Chris Nicholson-Sauls
|
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Nicholson-Sauls | Chris Nicholson-Sauls wrote:
> BCS wrote:
>> Reply to Vermi,
>>
>>> sorry for my english.
>>
>> Why is it that only the forever who have good English apologies for it? :b
>
> I've often wondered. In fact, one of my personal friends with the best command of the language is a Netherlander. (Sure their language isn't as far off, but still.) I think the common -- albeit accurate -- axiom of "English is the hardest language to learn" makes them more self-conscious, perhaps? Somebody set us up the bomb. All your base are belong to us.
Well, over here in the Netherlands English is a required[1] course for 6 to 8 years[2] of school, so the Dutch speaking English relatively well (on average) is not entirely unexpected. Also, the master's phase of university education is now taught entirely in English.
By the way, I've heard that /Dutch/ is actually one of the hardest languages to learn[3]...
[1] Or at least, it was for me. I'm not sure what it's like right now, they overhauled the education system just after my year...
[2] Depending on the "level" of education you're attending.
[3] (as a second language)
|
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Nicholson-Sauls | Chris Nicholson-Sauls wrote:
> BCS wrote:
>> Reply to Vermi,
>>
>>>
>>> I saw phobos has a .a file in the lib directory, should my modules
>>> have one too ?
>>>
>>
>> That is a lib file for linux, you shouldn't need to make a lib file of your own.
>>
>>> sorry for my english.
>>
>> Why is it that only the forever who have good English apologies for it? :b
>>
>
> I've often wondered. In fact, one of my personal friends with the best command of the language is a Netherlander. (Sure their language isn't as far off, but still.) I think the common -- albeit accurate -- axiom of "English is the hardest language to learn" makes them more self-conscious, perhaps? Somebody set us up the bomb. All your base are belong to us.
Not to nitpick or anything but I believe you mean "Somebody set *up* *us* the bomb." I'm guessing AYBian is not your first language. :-)
--bb
|
May 14, 2007 Re: Cannot make a personalized exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote:
> Chris Nicholson-Sauls wrote:
>> BCS wrote:
>>> Reply to Vermi,
>>>
>>>>
>>>> I saw phobos has a .a file in the lib directory, should my modules
>>>> have one too ?
>>>>
>>>
>>> That is a lib file for linux, you shouldn't need to make a lib file of your own.
>>>
>>>> sorry for my english.
>>>
>>> Why is it that only the forever who have good English apologies for it? :b
>>>
>>
>> I've often wondered. In fact, one of my personal friends with the best command of the language is a Netherlander. (Sure their language isn't as far off, but still.) I think the common -- albeit accurate -- axiom of "English is the hardest language to learn" makes them more self-conscious, perhaps? Somebody set us up the bomb. All your base are belong to us.
>
> Not to nitpick or anything but I believe you mean "Somebody set *up* *us* the bomb." I'm guessing AYBian is not your first language. :-)
>
> --bb
You know, just to be anal, I went and looked it up... and you're right. Heh.
-- Chris Nicholson-Sauls
|
Copyright © 1999-2021 by the D Language Foundation