cargo-watch seems to search the debug executable in the wrong folder when trying to execute a test source code
AnotherCoder1 opened this issue · 3 comments
I was watching a web server application tutorial using axum
from here.
After installing cargo-watch by using cargo install cargo-watch
,
the command cargo watch -q -c -w src/ -x run
is issued, and it works by compiling and running the code.
Later, the command cargo watch -q -c -w tests/ -x "test quick_dev -- --nocapture"
is used from other terminal, an exception occurred.It says:
note: LINK : fatal error LNK1104: cannot open file 'C:\Users\<username>\Desktop\rust_projects\http_interceptor\target\debug\deps\http_interceptor.exe'
The exception message in the terminal seems to suggest that it cannot find the debug executable. It says that it has link error.
Apparently, cargo-watch try to find the debug executable in the
target/debug/deps
, whereas the executable is in the target/debug
directory.
So, what could be done to solve this issue?
It seems that in the target/debug/deps
folder there is in fact the executable program named http_interceptor.exe
. When i tried to double click it it can run like usual, but cannot be run from the terminal using the above specific command.
found the solution here.
I need to switch the runtime from 32-bit into 64-bit i guess.
'rustup default stable-x86_64-pc-windows-gnu'.
And it kind of work
cargo watch only calls cargo run, test, etc. if these commands work from outside cargo watch, then that might be a cargo watch issue. otherwise, it's either a misconfiguration in your project (as here) or a cargo issue.