Need help with cross-platform debugging issues on vscode

I used vscode+wsl+rust-analyzer to write a program that requires windows clipboard, for cross-platform syntax checking, setting to x86_64-pc-windows-gnu worked, but when I tried to use Run | Debug to debug my program, the target parameter doesn't seem to take effect. Here is the error message in the terminal.

> Executing task: cargo run --package clipboard-sync-client --bin clipboard-sync-client <

   Compiling clipboard-sync-client v0.1.0 (/home/wsl_halc/repo/clipboard-sync-rs/clipboard-sync-client)

error[E0432]: unresolved imports `clipboard_win::formats`, `clipboard_win::Clipboard`, `clipboard_win::Getter`, `clipboard_win::Setter`, `clipboard_win::SysResult`

 --> clipboard-sync-client/src/


8 | use clipboard_win::{formats, Clipboard, Getter, Setter, SysResult};

  |                     ^^^^^^^  ^^^^^^^^^  ^^^^^^  ^^^^^^  ^^^^^^^^^ no `SysResult` in the root

  |                     |        |          |       |

  |                     |        |          |       no `Setter` in the root

  |                     |        |          no `Getter` in the root

  |                     |        no `Clipboard` in the root

  |                     no `formats` in the root

For more information about this error, try `rustc --explain E0432`.

error: could not compile `clipboard-sync-client` due to previous error

The terminal process "cargo 'run', '--package', 'clipboard-sync-client', '--bin', 'clipboard-sync-client'" terminated with exit code: 101.

By the way, I have no problems with cargo build --target x86_64-pc-windows-gnu, so I think the problem is with rust-analyzer, but I'm not quite sure how to use it correctly

As far as I understand it, rust-analyzer doesn't provide debugging support. Are you getting that from another extension, such as CodeLLDB?

Rust-analyzer provides support for building your project and then invoking one of the common debugger extensions I believe.

1 Like

I see, it should refer to something like CodeLLDB expansion, but it seems that the Debug in-line prompt does not seem to be able to use launch.json to modify the parameters, so I still give up using WSL and continue to use the Windows environment

No, for temporary convenience I changed to try to continue writing code on Windows

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.