Hy I'm new to Rust and currently working through the "Book" but there's something with Cargo that's a little bit annoying. Sometimes, when I make a new project and run it the first time with cargo run
, everything's fine but when I make a small change to the code after that and run it again I get an error:
error: failed to link or copy C:\...\rust_projects\learning_rust\branches\target\debug\deps\branches-14bae1fca06ad47d.exe
to C:\...\rust_projects\learning_rust\branches\target\debug\branches.exe
Caused by:
Access is denied. (os error 5)
The .exe file under \debug disappears and I'm also not able to for example delete the folder even as admin. A restart solves the problem with the permission but it's still annoying to be forced to create the project again, copy and paste the code and so on.
Using cargo build
instead of run
had no effect. I'm using Windows 10. Maybe someone of you had a similar issue and could help me understand what causes the problem.