Thread overview
why can't I use --eval and pass a file at same time?
2 days ago
Neto
2 days ago
Neto
2 days ago

why can't use do something like this?

import std.stdio : writeln, writefln;

void main()
{
	writeln("Hello");
}

and pass a file like:

>

rdmd aa.d --eval="write("hello");"

returns

object.Exception@rdmd.d(193): Cannot have both --eval and a program file ('eval.d').
----------------
??:? pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x50e882]
??:? pure @safe bool std.exception.enforce!().enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x57954f]
??:? _Dmain [0x505753]
2 days ago
That version of rdmd must be quite old, I can't find that message in its source.

https://github.com/dlang/tools/blob/master/rdmd.d#L193
2 days ago
On Tuesday, 24 June 2025 at 19:06:17 UTC, Richard (Rikki) Andrew Cattermole wrote:
> That version of rdmd must be quite old, I can't find that message in its source.
>
> https://github.com/dlang/tools/blob/master/rdmd.d#L193

I've just downloaded it. I'm using rdmd build 20200216 on wslinux and on windows rdmd build 20250331
2 days ago
On 25/06/2025 7:57 AM, Neto wrote:
> On Tuesday, 24 June 2025 at 19:06:17 UTC, Richard (Rikki) Andrew Cattermole wrote:
>> That version of rdmd must be quite old, I can't find that message in its source.
>>
>> https://github.com/dlang/tools/blob/master/rdmd.d#L193
> 
> I've just downloaded it. I'm using rdmd build 20200216 on wslinux and on windows rdmd build 20250331

Okay found the commit that removed it: https://github.com/dlang/tools/commit/5e0317a4e863bc3f8a822e7b3b302c8795eb3804

Update your compiler.