Link Errors on Windows with VS Code

This is a long shot but not sure where to start.

I've been consistently getting link errors on Windows against dependencies .dll files saying "LNK1104: cannot open file"

This is a different dependency each time and if I keep building it eventually builds but it is getting pretty frustrating. I tried disabing antivirus in case it was locking files but it didn't seem to help. I'm running in VSCode with Rust Analyzer but I've not had issues like this before.

It feels like some kind of race condition with another tool - if I run cargo clean first it seems to be more successful and does always compile in the end.

This is on rustc 1.76.0 and the latest rust-analyzer

Do the errors also occur when you execute cargo build inside a terminal, without VSCode open?

Yeah it does seem to as well actually so it seems a little more core.

I think there may be two issues that are triggering it:

  • I think an antivirus was causing the failures. I've tried an alternative one that allows me to properly exclude them to see if it will help.
  • Something in this project is also causing a lot more recompiling of dependencies than I would expect. Perhaps something to do with the feature combinations across the workspace?

I'll report back on the antivirus once I've done enough to be sure it has made a change