gpt4 book ai didi

c++ - WSL Ubuntu 20.04.3 错误 : XDG_RUNTIME_DIR not set in the environment

转载 作者:行者123 更新时间:2023-12-04 19:05:42 32 4
gpt4 key购买 nike

我在 Windows 10 上使用 Ubuntu 20.04.3 WSL。我将我的 C++ 程序(使用 SDL2 库)编译为名为“main”的可执行文件。

g++ -o main main.cpp CApp.cpp -lSDL2 -std=c++17

当我尝试使用以下命令运行可执行文件时:

./main

它返回:

error: XDG_RUNTIME_DIR not set in the environment.

最佳答案

感谢您的评论。答案已经在这里得到解答:QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aadithyasb'

至于为什么可执行文件无法在 WSL 中运行,原因是 WSL2(截至 2021 年 12 月)尚未支持 GUI 应用程序。它仅适用于 Windows 11 Insider。这是链接:

https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

You will need to be on Windows 11 Build 22000 or higher to access this feature.

关于c++ - WSL Ubuntu 20.04.3 错误 : XDG_RUNTIME_DIR not set in the environment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70469462/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com