Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Windows 10和Ubuntu Linux子系统之间共享文件?_Linux_Gcc_Compiler Errors_Windows Subsystem For Linux_Permission Denied - Fatal编程技术网

如何在Windows 10和Ubuntu Linux子系统之间共享文件?

如何在Windows 10和Ubuntu Linux子系统之间共享文件?,linux,gcc,compiler-errors,windows-subsystem-for-linux,permission-denied,Linux,Gcc,Compiler Errors,Windows Subsystem For Linux,Permission Denied,我不熟悉Windows Linux子系统(WSL) 如何在Windows 10和Ubuntu Linux子系统之间高效地共享文件? 我遵循这一点,在下面的路径中找到在WSL中创建的文件。 C:UsersuserAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows\u 79rhkp1ndgsclocalstateoutfshomehsuchicentesktop 我可以将c代码从WSL移动到win10。 然而,当我将c代码从

我不熟悉Windows Linux子系统(WSL)

如何在Windows 10和Ubuntu Linux子系统之间高效地共享文件?

我遵循这一点,在下面的路径中找到在WSL中创建的文件。
C:UsersuserAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows\u 79rhkp1ndgsclocalstateoutfshomehsuchicentesktop

我可以将c代码从WSL移动到win10。 然而,当我将c代码从win10移动到WSL并用GCC编译它时。 它失败并收到此错误消息。 我不知道如何修理它。这是共享文件的好方法吗

$ gcc -o Tree Tree.c
cc1: fatal error: Tree.c: Permission denied
compilation terminated.
这是共享文件的好方法吗

$ gcc -o Tree Tree.c
cc1: fatal error: Tree.c: Permission denied
compilation terminated.
当然不是

很抱歉这么严厉,但我建议你对那个YouTube视频投反对票(我刚刚投了)。微软表示,几年前它就应该离线了

关于从Windows访问WSL/Linux文件的正确方法,在同一个Microsoft devblog中有一个答案——使用
\\WSL$\distroname
(例如
\\WSL$\Ubuntu

然而,对于使用VisualStudio代码的用例,还有一种更好的方法。在VSCode中安装Microsoft的“Remote-WSL”扩展(或“Remote Development”扩展,其中包括“Remote-WSL”)


然后,将文件放在WSL中的某个位置,如
~/src/myproject
。当您需要使用GCC访问这些文件时,没有问题——这是一个访问Linux文件系统上文件的Linux工具。当您需要编辑VSCode中的文件时,只需在WSL中切换到该目录并
code.
。这将在该WSL目录中启动VSCode,并具有其他集成功能。

尝试以管理员身份运行Visual Studio,但它不起作用。