这里完全是菜鸟。
我想在 Windows 机器上使用一些 C 库,例如 unistd.h 和 sys/time.h。我发现很多线程都在讨论是否不使用替代包就根本不可能。但我想知道适用于 Linux 的 Windows 子系统是否带有这些库?如果是这样,我该如何配置 Visual Studio Code 使用 WSL?
最佳答案
But I wonder does the Windows Subsystem for Linux come with those libraries?
是的,WSL 中的编译器将包含这些 header 。
If so, how do I configure Visual Studio Code work with WSL?
您需要在 Windows 功能中启用 WSL,通过 Microsoft Store 安装您喜欢的 linux 发行版,在 VS Code 中安装“Remote - WSL”扩展。 可以在此处找到更多信息:https://code.visualstudio.com/docs/remote/wsl
不过请记住,您将在此设置中编译的应用程序将是 Linux 应用程序。他们将只能在 linux 或 WSL 下运行。 您无法使用这些库为 Windows 编译应用程序。这些库依赖于平台。
关于c - Linux 原生 C 库 : How to configure Visual Studio Code to work with them on Windows?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53515291/