www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot make a personalized exception

reply Vermi <aurelien.vermifuge gmail.com> writes:
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
next sibling parent reply BCS <ao pathlink.com> writes:
Reply to Vermi,

[...]

can you post a minimal test case?
May 11 2007
parent Vermi <aurelien.vermifuge gmail.com> writes:
Content-Type: text/plain

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
prev sibling parent reply "Stewart Gordon" <smjg_1998 yahoo.com> writes:
"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;
    }
 }

Any particular reason you're overriding toString to do exactly what it already does? Stewart.
May 11 2007
parent reply Vermi <aurelien.vermifuge gmail.com> writes:
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;
    }
 }

Any particular reason you're overriding toString to do exactly what it already does? Stewart.

May 14 2007
parent reply BCS <ao pathlink.com> writes:
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
parent reply Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
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
next sibling parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
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
parent Mike Parker <aldacron71 yahoo.com> writes:
Frits van Bommel wrote:

 
 By the way, I've heard that /Dutch/ is actually one of the hardest 
 languages to learn[3]...

 [3] (as a second language)

Actually, there's a scale for this. I can't recall the name of it, but it ranks languages mostly by group according to several criteria. On one end of the scale are latin- and germanic-based languages. On the other end is Chinese. The closer two languages are to each other the easier it is for speakers of each language to learn the other. The farther apart they are, the more difficult to learn.
May 14 2007
prev sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
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
parent Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
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
May 14 2007