gpt4 book ai didi

c - VS2019 linux头文件

转载 作者:太空宇宙 更新时间:2023-11-04 06:11:40 24 4
gpt4 key购买 nike

我正在尝试使用 VS2019 为 Linux 开发 C 代码。

我发现虽然许多 Linux header (例如 sys/types.h 和 sched.h)被发现正常,但其他 header (例如 sys/syscall.h 和 fcntl.h)却找不到。

我可以看到它在本地 linux 平台目录中有许多头文件的本地副本,例如 stdint.h...我可以从目标机器上剪切并粘贴丢失的头文件吗?

我宁愿怀疑,如果缺少 unistd.h 等通用 header ,那是有原因的,我不想把事情搞砸!

最佳答案

来自 Microsoft's documentation:

By default, Visual Studio does not include any system-level include files from the Linux computer. For example, items in the /usr/include directory are not present in Visual Studio. For full IntelliSense support, you will need to copy those files to some location on your development computer and point Visual Studio to this location. One option is to use scp (Secure Copy) to copy the files. On Windows 10, you can use Bash on Windows to run scp. For previous versions of Windows, you could use something like PSCP (PuTTY Secure Copy).

You can copy the files by using a command similar to the following:

scp -r linux_username@remote_host:/usr/include .

Of course, replace the linux_username and remote_host values above for what's appropriate in your own environment.

Once the files are copied, use the VC++ Directories item in Project properties to tell Visual Studio where to find the additional include files that were just copied.

关于c - VS2019 linux头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54828465/

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