Hi,
I am getting compilation error while implementing the nesting of modules as
per the Rust Language tutorial.
Below is the description of my code structure.

Inside example directory,I created a file orig.rs and declared 3 modules a,
b and c inside it. Inside module c, I declared another module inner_mod. I
created 3 files a.rs, b.rs and c.rs and one directory c, all inside the
example directory.Also, I created another file inner_mod.rs and kept it in
c directory. In c.rs, I defined a function *C_func* as below.

pub fn *c_func*() {
io::println("I am in c");
}
I called the function c_func in file test_orig.rs which is in example
directory.
As per the tutorial, I can create c.rs file and c directory both,  but
nothing is mentioned about the location of c.rs with respect to c directory
i.e. whether c.rs will be kept inside c directory or outside of it at the
same level as c directory inside example directory. I tried both and got
the below error in each case when compiled:

*test_orig.rs:8:0: 8:15 error: unresolved name: orig::c::c_func
test_orig.rs:8 orig::c::c_func();*

Tar file of the code is attached.Please suggest a solution to this.


thanks
Ranvijay

Attachment: example.tar
Description: Unix tar archive

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to