c - Linux 原生 C 库 : How to configure Visual Studio Code to work with them on Windows?

标签 c windows visual-studio-code windows-subsystem-for-linux

这里完全是菜鸟。

我想在 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/

相关文章:

c - 什么时候在将数组声明为指向数组的指针时分配内存

java - Cmd 错误 - 存储空间不足,无法处理此命令

visual-studio-code - 如何使用 Visual Studio Code + VSCode 远程 + Chrome 调试器调试 Angular 应用程序

c++ - 如果变量 a 是一个 char 数组是 char* p = &a 在 C++ 中定义的行为

c - 使用 libCurl 构建 SMTP 客户端

C 中的计数排序

MySQL 和 C 编程语言

c++ - 检测模拟键盘/鼠标输入

visual-studio-code - 如何禁用从 VSCode 中的特定文件自动导入?

javascript - 匹配 Sublime es6 语法高亮