Reputation: 1008
For a while I have been editing my Rust program with Pycharm Professional. However, I was curious and experimented with VS Code. At first my project was compiling and running. However, it suddenly started throwing a pretty wild error on cargo build and cargo run (while cargo check is fine), even in cmd outside of VS Code:
error: linking with `link.exe` failed: exit code: 1104
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\rust\\book\\target\\debug\\deps\\book.1apvyby1qhuehv3.rcgu.o" "C:\\rust\\book\\target\\debug\\deps\\book.1cw7xmk0cjjg5uln.rcgu.o" "C:\\rust\\book\\target\\debug\\deps\\book.1e8ho0j4rykowhcr.rcgu.o" "C:\\rust\\book\\target\\debug\\deps\\book.1g2fbveo2gp7bxds.rcgu.o"
..............
..............
= note: LINK : fatal error LNK1104: cannot open file 'C:\rust\book\target\debug\deps\book.exe'
book is the name of my project. I am on Windows 10, System Type: x64-based PC. VS Code version 1.63.2
Upvotes: 1
Views: 3457
Reputation: 399
Sometimes VSCode file watcher watches the files in target/
, that is not good.
So open the Settings, search for exclude, and in all "list-like" cofigurations add **/target/**
, do a cargo clean
and restart VSCode. This should fix this and future problems
Upvotes: 4
Reputation: 1008
Had to remove the directory, and redownload the whole project(used Git).
Upvotes: 0