On Friday, September 17, 2010 09:21:07 Graham Nicholls wrote: > I'm getting a little confused. I've installed a .deb package of d 2.0, but > now my code won't compile: > unlogcat.d(112): Error: std.stream.File at > /usr/include/d/dmd/phobos/std/stream.d(1787) conflicts with std.stdio.File > at /usr/include/d/dmd/phobos/std/stdio.d(248) > > Yet if I leave either out, I get unresolved symbols. Also, where can I > find out what exceptions can be raised for a particular operation ? > Thanks
If you import two modules which have the same symbol in them (be it a function, a struct, or whatnot) and you use that symbol in your code without fully qualifying it, and it's ambiguous as to which one you meant, the compiler won't compile it. You have to fully qualify it. From the looks of it, you have imported both std.stream (which is going to be deprecated by the way) and std.stdio. std.stream has a File class and std.stdio has a File struct. So, if you use File in your module, then it's ambiguous as to which you mean. To avoid the problem you either have to a named import (or whatever it's called) - e.g. import io = std.stdio - and use that name to qualify anything you use in that module (e.g. io.File), or you have to fully qualify the name (std.stdio.File). You might be able to specifically import a symbol from a module, but I don't remember how. In any case, your problem is that you've imported two modules with the same symbol in them, and you've tried to use that symbol, so the compiler doesn't know which one you mean, and you have to be more specific so that it knows which you mean. - Jonathan M Davis