title: How can I include a module from another file from the same project?
body: <p>By following <a href="https://doc.rust-lang.org/0.12.0/guide.html#crates-and-modules" rel="noreferrer">this guide</a> I created a Cargo project.</p>
  <p><strong><code>src/main.rs</code></strong></p>
  <pre><code>fn main() {
      hello::print_hello();
  }
  
  mod hello {
      pub fn print_hello() {
          println!(&quot;Hello, world!&quot;);
      }
  }
  </code></pre>
  <p>which I run using</p>
  <pre class="lang-none prettyprint-override"><code>cargo build &amp;&amp; cargo run
  </code></pre>
  <p>and it compiles without errors. Now I'm trying to split the main module in two but cannot figure out how to include a module from another file.</p>
  <p>My project tree looks like this</p>
  <pre class="lang-none prettyprint-override"><code>├── src
      ├── hello.rs
      └── main.rs
  </code></pre>
  <p>and the content of the files:</p>
  <p><strong><code>src/main.rs</code></strong></p>
  <pre><code>use hello;
  
  fn main() {
      hello::print_hello();
  }
  </code></pre>
  <p><strong><code>src/hello.rs</code></strong></p>
  <pre><code>mod hello {
      pub fn print_hello() {
          println!(&quot;Hello, world!&quot;);
      }
  }
  </code></pre>
  <p>When I compile it with <code>cargo build</code> I get</p>
  <pre class="lang-none prettyprint-override"><code>error[E0432]: unresolved import `hello`
   --&gt; src/main.rs:1:5
    |
  1 | use hello;
    |     ^^^^^ no `hello` external crate
  </code></pre>
  <p>I tried to follow the compiler's suggestions and modified <code>main.rs</code> to:</p>
  <pre><code>#![feature(globs)]
  
  extern crate hello;
  
  use hello::*;
  
  fn main() {
      hello::print_hello();
  }
  </code></pre>
  <p>But this still doesn't help much, now I get this:</p>
  <pre class="lang-none prettyprint-override"><code>error[E0463]: can't find crate for `hello`
   --&gt; src/main.rs:3:1
    |
  3 | extern crate hello;
    | ^^^^^^^^^^^^^^^^^^^ can't find crate
  </code></pre>
  <p>Is there a trivial example of how to include one module from the current project into the project's main file?</p>