【问题标题】:Debug C++ in VS2017 on WSL - unknown arch error在 WSL 上的 VS2017 中调试 C++ - 未知的拱形错误
【发布时间】:2017-07-31 06:46:42
【问题描述】:

我在 vs2017 中创建了一个 c++ linux 项目。 我设置了与 WSL(Linux 的 Windows 子系统)的连接。 当我构建或尝试调试时,我收到以下错误:

Current project architecture ‘x64’ is incompatible with the remote system architecture ” (‘Unknown’). Please switch the project architecture to ” in Configuration Manager

如何解决?

【问题讨论】:

    标签: c++ linux visual-studio-2017 windows-subsystem-for-linux


    【解决方案1】:

    原来这是一个坏 ssh 连接的产物。 我认为它试图连接到 windows ssh 服务器,该服务器劫持连接而不是转发到 WSL。

    首先我将visual studio中的连接端口(工具->选项->跨平台->连接管理器)从默认的22改为222。

    此外,我发现以下步骤在 WSL 方面很有帮助(取自 https://www.reddit.com/r/bashonubuntuonwindows/comments/5gh4c8/ssh_to_bash_on_wsl/):

    • 编辑 /etc/ssh/sshd_config 并更改监听端口。在这个演示中,我使用了 222 端口。

    • 将 UsePrivilegeSeparation 更改为“no”(因为 Linux 的 Windows 子系统的实现不提供 chroot)

    • 将 PasswordAuthentication 更改为“是”

    • 在 Windows 端添加一条防火墙规则,用于 SSH 到您的新侦听端口

    • sudo ssh-keygen -A

    • 重启ssh服务:sudo service ssh --full-restart

    • 在本地测试 ssh 连接并启用详细模式(详细模式可选):ssh localhost -p "your-port-here" -v

    • 从另一个系统测试。 (一切都应该正常)

    【讨论】:

    • 您应该使用端口 2222,因为端口 222 低于 1024 并保留。其实在reserved port list中,并没有应用程序使用它,但这是一个很好的做法。
    猜你喜欢
    • 1970-01-01
    • 2017-08-17
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-18
    • 1970-01-01
    • 2021-01-12
    相关资源
    最近更新 更多