Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to make example work? #1

Open
ultrasaurus opened this issue Jan 16, 2020 · 1 comment
Open

how to make example work? #1

ultrasaurus opened this issue Jan 16, 2020 · 1 comment

Comments

@ultrasaurus
Copy link
Owner

ultrasaurus commented Jan 16, 2020

I'd like to understand how to put crate at the root. I did an experiment (see branch crate-root, but I couldn't figure out syntax for including the lib. Probably something really basic I'm missing here...

cargo run --example stdin

output

   Compiling add v0.1.0 (/Users/sallen/src/rust/clib)
error[E0432]: unresolved import `add`
 --> examples/stdin.rs:1:5
  |
1 | use add::add;
  |     ^^^ use of undeclared type or module `add`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `add`.
@ultrasaurus ultrasaurus changed the title example doesn't compile how to make example work with crate at root? Feb 8, 2020
@ultrasaurus ultrasaurus changed the title how to make example work with crate at root? how to make example work? Feb 8, 2020
@ultrasaurus
Copy link
Owner Author

I don't think this had anything to do with moving crate to the root (since example still fails at master, when I reset history to before this change)

I think we need to tell cargo to build the c library and the rust library with two target crate types:

crate-type = ["staticlib", "lib"]    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant