December 12, 2015 Dmd doesn't like tuples or me :> | ||||
---|---|---|---|---|
| ||||
import std.stdio; import std.typecons; int main(string[] argv) { auto value = Tuple(5, 6.7, "hello"); assert(value[0] == 5); assert(value[1] == 6.7); assert(value[2] == "hello"); writeln("Hello D-World!"); return 0; } // Standard example copied from the docs VisualD (VS 2015) Output: ------ Build started: Project: ConsoleApp1, Configuration: Debug Win32 ------ Building Debug\ConsoleApp1.exe... Error: cannot find source code for runtime library file 'object.d' dmd might not be correctly installed. Run 'dmd -man' for installation instructions. config file: C:\D\dmd2\windows\bin\sc.ini import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import Building Debug\ConsoleApp1.exe failed! Details saved as "file://C:\MyProjects\D\ConsoleApp1\ConsoleApp1\Debug\ConsoleApp1.buildlog.html" ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
December 11, 2015 Re: Dmd doesn't like tuples or me :> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Enjoys Math | On 12/11/2015 05:41 PM, Enjoys Math wrote: > import std.stdio; > import std.typecons; > > int main(string[] argv) > { > auto value = Tuple(5, 6.7, "hello"); I don't understand how it relates to the error message but you should use lowercase 'tuple' there: auto value = tuple(5, 6.7, "hello"); tuple() is the convenience function template that takes care of type deduction. Otherwise, you would have to write it like this: auto value = Tuple!(int, double, string)(5, 6.7, "hello"); Both lines are equivalent. Ali |
Copyright © 1999-2021 by the D Language Foundation