Skip to content
This repository has been archived by the owner on Jun 6, 2020. It is now read-only.

'currency' is not defined #2

Closed
joelcnz opened this issue Jul 2, 2016 · 2 comments
Closed

'currency' is not defined #2

joelcnz opened this issue Jul 2, 2016 · 2 comments

Comments

@joelcnz
Copy link

joelcnz commented Jul 2, 2016

I not sure I understand dub.

I get this with the code below:

Joels-MacBook-Pro:Money joelcnz$ dub
Performing "debug" build using dmd for x86_64.
money 1.0.0: target for configuration "library" is up to date.
jmoney ~master: building configuration "application"...
source/app.d(6,14): Error: template instance currency!"EUR" template 'currency' is not defined
dmd failed with exit code 1.
Joels-MacBook-Pro:Money joelcnz$

{
"name": "jmoney",
"description": "A minimal D application.",
"dependencies":
{
"money": "~>1.0.0"
}
}

[code]
import std.stdio;

import money;

void main() {
alias EUR = currency!("EUR");

assert(EUR(100.0001) == EUR(100.00009));
assert(EUR(3.10) + EUR(1.40) == EUR(4.50));
assert(EUR(3.10) - EUR(1.40) == EUR(1.70));
assert(EUR(10.01) * 1.1 == EUR(11.011));

writefln("%d", EUR(3.6)); // "4EUR"
writefln("%f", EUR(3.141592)); // "3.1416EUR"
writefln("%.2f", EUR(3.145)); // "3.15EUR"

}
[/code]

@qznc
Copy link
Owner

qznc commented Jul 2, 2016

You are still using v1.0.0, which is broken. Dub remembers the version of a package in dub.selections.json to essure builds are repeatable.

Switch to v2.0.0 by deleting dub.selections.json.

@joelcnz
Copy link
Author

joelcnz commented Jul 4, 2016

Ok, got it working! Thanks.

@joelcnz joelcnz closed this as completed Jul 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants