# Using Printf

**URL:** https://discourse.julialang.org/t/using-printf/12919
**Category:** General Usage
**Created:** [August 5, 2018, 5:10pm UTC](https://discourse.julialang.org/t/using-printf/12919 "2018-08-05T17:10:28Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [August 5, 2018, 5:10pm UTC](https://discourse.julialang.org/t/using-printf/12919/1 "2018-08-05T17:10:28Z")

</div>

I am trying to make a package work on 0.6 and 0.7.

A warning told me to add “using Printf”  
Another warning told me to add this to the dependancies, but I don’t know how.  
I just added Printf as dependency, but a) this doesn’t exist on 0.6 and b) I get the following message:

```julia
(v0.7) pkg> resolve
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: The following package names could not be resolved:
 * Printf (de0858da-6303-5e67-8744-51eddeeeb8d7 in manifest but not in project)
Please specify by known `name=uuid`.

```

Any idea?

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [August 5, 2018, 6:28pm UTC](https://discourse.julialang.org/t/using-printf/12919/2 "2018-08-05T18:28:38Z")

</div>

If you have a `REQUIRE`-style package you should not add `Printf` to dependencies, just add `using Printf` to your code.  
When you have a `Project.toml` style package you need to have `Printf` in `[deps]`.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [August 5, 2018, 6:38pm UTC](https://discourse.julialang.org/t/using-printf/12919/3 "2018-08-05T18:38:11Z")

</div>

So I should just ignore the following warning?

```julia
(v0.7) pkg> precompile
Precompiling project...
Precompiling ModiaMath
[Info: Recompiling stale cache file /home/ufechner/.julia/compiled/v0.7/ModiaMath/QuMbN.ji for ModiaMath [052f3798-2c4b-580c-9af4-6e8cb4bca120]
┌ Warning: Package ModiaMath does not have Printf in its dependencies:
│ - If you have ModiaMath checked out for development and have
│ added Printf as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with ModiaMath
└ Loading Printf into ModiaMath from project dependency, future warnings for ModiaMath are suppressed.

```

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [August 5, 2018, 6:43pm UTC](https://discourse.julialang.org/t/using-printf/12919/4 "2018-08-05T18:43:42Z")

</div>

Ok, I am using now:

```julia
@static if VERSION >= v"0.7.0-DEV.2005" @eval using Printf end

```

Now I don’t get any warning any more. Is this a good solution?

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [August 5, 2018, 7:22pm UTC](https://discourse.julialang.org/t/using-printf/12919/5 "2018-08-05T19:22:14Z")

</div>

`using Compat.Printf`

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [August 5, 2018, 7:42pm UTC](https://discourse.julialang.org/t/using-printf/12919/6 "2018-08-05T19:42:59Z")

</div>

So that also works with 0.6?  
And do I have to add Compat to the REQUIRES file?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 5, 2018, 7:43pm UTC](https://discourse.julialang.org/t/using-printf/12919/7 "2018-08-05T19:43:57Z")

</div>

Yes, yes.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [August 5, 2018, 7:44pm UTC](https://discourse.julialang.org/t/using-printf/12919/8 "2018-08-05T19:44:22Z")

</div>

Thanks! 🙂
