简体   繁体   中英

How to force DUB to use gdc over dmd?

I have both GDC and DMD installed on windows, and am using DUB to build and test my project. DUB automatically uses DMD, but I would also like to use the GDC compiler through DUB. The DUB package reference here implies you can use different compilers, but doesn't specify how to do it.

I tried just removing DMD from my system path hoping that it would find GDC instead, but now it just complains that it can't find DMD.

You use dub --compiler=gdc .

It's documented but somewhat unintuitively. You need to do dub build -h (build is the default action).

The same option can be used to perform cross-compilation, eg dub build --compiler=arm-linux-gnueabihf-gdc . See https://github.com/rejectedsoftware/vibe.d/issues/1079#issuecomment-111798195

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM