Strange behaviour of rdmd vs. dmd concerning main function

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 9 11:10:55 PST 2017


Dne 9.2.2017 v 17:20 berni via Digitalmars-d-learn napsal(a):

>> dmd only compiles in the files you actually pass to it. rdmd will try 
>> to find the required files automatically.
>>
>> Since you didn't pass the file with the function to dmd, it knows it 
>> exists, but leaves it out of the final link (it assumes it might come 
>> from a library or something). That's why you see the error.
>
> Ah ok, I understand. So calling with "dmd Special/special.d 
> Common/common.d" works.
>
> But when I compile common.d to common.o (with dmd -c common.d) and 
> remove common.d after that is there still a possibility to link? The 
> obvious doesn't work:
>
>> $> dmd Special/special.d Common/common.o Special/special.d(4): Error: 
>> module common is in file 'common.d' which cannot be read
>> import path[0] = /usr/include/dmd/phobos
>> import path[1] = /usr/include/dmd/druntime/import
>
Thats ok too, you still need to add -ICommon
dmd -ICommon Special/special.d Common/common.o


More information about the Digitalmars-d-learn mailing list