# LoadError: error in method definition: function Base.min must be explicitly imported to be extended

**URL:** <https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362>\
**Category:** Statistics\
**Created:** [April 25, 2017, 2:16am UTC](https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362 "2017-04-25T02:16:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wael\_Sboui](https://avatars.discourse-cdn.com/v4/letter/w/a88e57/32.png) [@Wael\_Sboui](https://discourse.julialang.org/u/Wael_Sboui)\
**Post date:** [April 25, 2017, 2:16am UTC](https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362/1 "2017-04-25T02:16:35Z")

</div>

Hi everybody,  
I’m working under Julia 0.5.1 and I face this problem below:

```julia
Error evaluating AirplaneRealStats5.9.jl
LoadError: LoadError: error in method definition: function Base.min must be explicitly imported to be extended
while loading C:\Users\sbouiw.ADS-IRO.002\Desktop\Airplane-V5.9\collectors.jl, in expression starting on line 480
while loading C:\Users\sbouiw.ADS-IRO.002\Desktop\Airplane-V5.9\AirplaneRealStats5.9.jl, in expression starting on line 3
 in include_from_node1(::String) at loading.jl:488
 in include_string(::String, ::String) at loading.jl:441
 in include_string(::Module, ::String, ::String) at eval.jl:32
 in (::Atom.##59#62{String,String})() at eval.jl:81
 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30
 in withpath(::Function, ::String) at eval.jl:46
 in macro expansion at eval.jl:79 [inlined]
 in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60

```

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [April 25, 2017, 3:49am UTC](https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362/2 "2017-04-25T03:49:54Z")

</div>

Presumably you are trying to adding a method to `Base.min` function.  
As the error message indicates, you need to explicitly import Base.min.

Example:

```julia
type MyType
    x::Int
end

```

```julia
import Base.min
min(a::MyType, b::MyType) = min(a.x, b.x)

```

or else fully specify:

```julia
Base.min(a::MyType, b::MyType) = min(a.x, b.x)

```

---

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [April 25, 2017, 6:59am UTC](https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362/3 "2017-04-25T06:59:49Z")

</div>

Note also that generally speaking, it is unnecessary to extend the `min` function; just extend `<` or `isless` as appropriate (see the documentation for when to extend each).

---

<div class="post-metadata">

**Author:** ![Wael\_Sboui](https://avatars.discourse-cdn.com/v4/letter/w/a88e57/32.png) [@Wael\_Sboui](https://discourse.julialang.org/u/Wael_Sboui)\
**Post date:** [April 25, 2017, 2:03pm UTC](https://discourse.julialang.org/t/loaderror-error-in-method-definition-function-base-min-must-be-explicitly-imported-to-be-extended/3362/4 "2017-04-25T14:03:55Z")

</div>

Perfect.error solved. Thank you for your reactivity
