Ubuntu WSL 列在 Clion 工具链中,但表示 "not found"

Ubuntu WSL is listed in Clion toolchains but says "not found"

与此不同 or this one,CLion 似乎正确检测到 WSL:

您可以看到 Ubuntu-20.04 已列出但仍未找到:

版本:

有没有人遇到过这个问题?

问题似乎是,clion 找不到 WSL 的 cmake、C 编译器或 C++ 编译器。我猜你还没有安装它们。

您可以通过以下方式安装 gcc

sudo apt install build-essential

This article 说明如何构建 cmake:

Go to — https://cmake.org/files/ That shows all the list of the versions of cmake, I use cmake-3.15.0-rc1.tar.gz.

Open your terminal or bash and download it.

wget https://cmake.org/files/v3.15/cmake-3.15.0-rc1.tar.gz

After downloading, then untar.

tar -xvzf cmake-3.15.0-rc1.tar.gz
cd cmake-3.15.0-rc1/
./bootstrap
sudo make
sudo make install
cd /bin/
sudo cp cmake /usr/bin/

Now don’t forget we are currently in cmake-3.15.0-rc1/ just go back by entering cd ... that takes you up one directory back. Now copy the directory to /usr/bin/share

sudo cp -r cmake-3.15.0-rc1/ /usr/share/cmake-3.15
export CMAKE_ROOT=/usr/share/cmake-3.15

完成后,clion 应该能够正确检测到所有内容。

我问了 CLion 支持,如果答案是这样(这解决了我的问题)

Actually, the best way to solve this is to update Windows. If it's not possible, then in CLion go to Help | Find Action, type "Registry...", select it and in the opened list find and and disable the wsl.execute.with.wsl.exe option. It should help.