如何配置DUB以將我的應用程序編譯爲64位可執行文件?這裏是我的dub.json:配置DUB以使用64位編譯器
{
"name": "dvulkanbase",
"targetType": "executable",
"description": "Vulkan boilerplate",
"authors": ["Myself"],
"homepage": "http://something",
"license": "MIT"
}
我嘗試添加該行dub.json:
"dflags-dmd": ["-m64"]
但隨後dub build
輸出:
## Warning for package dvulkanbase ##
The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:
-m64: Use --arch=x86/--arch=x86_64/--arch=x86_mscoff to specify the target architecture
Performing "debug" build using dmd for x86.
所以我試着用替換行:
"dflags-dmd": ["--arch=x86_64"]
,但得到這個錯誤:
Error: unrecognized switch '--arch=x86_64'
我在Windows 10上,安裝了DMD 2.074.0和Visual Studio 2015和2017年。
您是否嘗試手動編譯並鏈接一個小D程序?我懷疑你沒有配置你的環境。如您所知,DUB正在使用編譯器/鏈接器 - 如果您沒有正確設置它,編譯/鏈接將失敗。它可能根本不是DUB問題......對於鏈接,如果我沒有記錯的話,DMD會使用Microsoft鏈接器。 – DejanLekic
我可以編譯和鏈接其他D程序,但這是我第一次嘗試構建64位程序並運行'dmd --arch = x86_64 source \ app.d'時出現相同的錯誤。 – SurvivalMachine
據我所知dmd沒有這個選項。它只有'-m64' ...這正是我所問 - 你能成功編譯(使用DMD)你想要的目標嗎? – DejanLekic