Thread overview
Conflicting variable- stdin
Jun 08, 2004
DemmeGod
Jun 08, 2004
Ivan Senji
Jun 08, 2004
DemmeGod
Jun 08, 2004
DemmeGod
June 08, 2004
I get the following error:
dmd -I. -Ibuild -c -ofbuild/daemon.o build/daemon.d
/usr/share/dmd/src/phobos/std/stream.d(2050): variable stdin conflicts with stdio.stdin at /usr/share/dmd/src/phobos/std/c/stdio.d(131)

When trying to compile the following code:
<snip>
private import com.neuralnexus.nnstore;
private import std.stream;
private import std.asserterror;

void main()
{
	while (1)
	{
		char[] inp = stdin.readLine();
		try
		{
			outTest(inp);
		}
		catch (AssertError e)
		{
			printf(e.toString() ~ "\n");
		}
	}
}
</snip>

This feels like a stupid error, but I can't find an obvious solution. When the stdin.readLine() is commented out, it compiles no problem.

Any suggestions?

TIA
John
June 08, 2004
I had lots of those errors:
try something like
alias std.stream.stdin stdin;
after the imports.

"DemmeGod" <me@demmegod.com> wrote in message news:pan.2004.06.08.21.01.06.108753@demmegod.com...
> I get the following error:
> dmd -I. -Ibuild -c -ofbuild/daemon.o build/daemon.d
> /usr/share/dmd/src/phobos/std/stream.d(2050): variable stdin conflicts
with stdio.stdin at /usr/share/dmd/src/phobos/std/c/stdio.d(131)
>
> When trying to compile the following code:
> <snip>
> private import com.neuralnexus.nnstore;
> private import std.stream;
> private import std.asserterror;
>
> void main()
> {
> while (1)
> {
> char[] inp = stdin.readLine();
> try
> {
> outTest(inp);
> }
> catch (AssertError e)
> {
> printf(e.toString() ~ "\n");
> }
> }
> }
> </snip>
>
> This feels like a stupid error, but I can't find an obvious solution. When the stdin.readLine() is commented out, it compiles no problem.
>
> Any suggestions?
>
> TIA
> John


June 08, 2004
Forgot to mention: if I make the two imports in AssertError private, it works, but I'm not sure how this will effect everything/anything else.

On Tue, 08 Jun 2004 17:01:09 -0400, DemmeGod wrote:

> I get the following error:
> dmd -I. -Ibuild -c -ofbuild/daemon.o build/daemon.d
> /usr/share/dmd/src/phobos/std/stream.d(2050): variable stdin conflicts
> with stdio.stdin at /usr/share/dmd/src/phobos/std/c/stdio.d(131)
> 
> When trying to compile the following code: <snip>
> private import com.neuralnexus.nnstore; private import std.stream;
> private import std.asserterror;
> 
> void main()
> {
> 	while (1)
> 	{
> 		char[] inp = stdin.readLine();
> 		try
> 		{
> 			outTest(inp);
> 		}
> 		catch (AssertError e)
> 		{
> 			printf(e.toString() ~ "\n");
> 		}
> 		}
> 	}
> </snip>
> 
> This feels like a stupid error, but I can't find an obvious solution. When the stdin.readLine() is commented out, it compiles no problem.
> 
> Any suggestions?
> 
> TIA
> John

June 08, 2004
Thanks. That works.  I tried doing:
char[] inp = std.stream.stdin.readLine();
but it spits out an undefined error.  What's different about alias that it
works?

John

On Tue, 08 Jun 2004 23:02:43 +0200, Ivan Senji wrote:

> I had lots of those errors:
> try something like
> alias std.stream.stdin stdin;
> after the imports.
>