Search code examples
rustrust-cargorust-cratesrust-piston

piston-opengl_graphics: `can't find crate`


I am building a piston program, which I committed yesterday. When running it unchanged today ( cargo run / cargo check), these are my error messages from the piston-opengl_graphics crate:

can't find crate for x for most of its dependancies; which seems to causes unresolved import or failed to resolve: maybe a missing crate as well.

This error first happened when trying cargo build --release (after many successful debug builds), but now occurs for any build / check.

I came back to the exact Piston-Tutorials' beginner guide, but the same errors occurred. The exact error message:

error[E0463]: can't find crate for `piston`
     --> C:\Users\win10\.cargo\registry\src\github.com-1ecc6299db9ec823\piston2d-opengl_graphics-0.82.0\src\back_end.rs:2:1
      |
    2 | extern crate piston;
      | ^^^^^^^^^^^^^^^^^^^^ can't find crate

I tried using a nightly rust version and changing piston-opengl_graphics version, in vain. (the latter gives me other errors)


Solution

  • I solved this by deleting the piston2d-opengl_graphics folder of the error message location.

    This was probably caused by some Windows admin restriction, because I couldn't remove the full folder instantly, while I could with others. (so I removed all its content, then removed the folder itself).