如何在 Windows 7 中与 Cygwin 建立符号链接
最近我测试了用 C/C++ 原生代码编写 Android 应用程序。问题在于使用 Android NDK 时创建符号链接。经过一番谷歌搜索后,有人说使用 Cygwin。我现在已经安装了。如何在 Windows 7 中与 Cygwin 建立符号链接?
Recently I have tested to write an Android application with native code in C/C++. The problem is in making symbolic links when using the Android NDK. After some googling, some say to use Cygwin. I have installed it now. How can I make a symbolic link with Cygwin in Windows 7?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简而言之,定义以下环境变量:
根据 Cygwin 文档:
您还应该确保以提升的权限运行 Cygwin(右键单击快捷方式并选择以管理员身份运行,或设置
mintty
快捷方式属性,高级 → 以管理员身份运行)。其他答案中提供了一些详细信息。
In short, define the following environment variable:
According to Cygwin documentation:
You should also make sure you run Cygwin with elevated privileges (right-click the shortcut and choose Run as Administrator, or set the
mintty
shortcut property, Advanced → Run as Administrator).Some details are provided in the other answer.
我第二天就收到了!所以,为了避免像我(Cygwin 新手)一样无知地思考,我现在回答这个问题。
使用常用命令为 Windows 7 创建符号链接很容易:
ln -s
答案是使用所需的包(例如
make
等)设置 Cygwin。阅读要求显然:Android NDK
I got it the next day! So, not to wrongly get ignorance thinking like me (newbie to Cygwin), I answer it now.
Making a symbolic link for Windows 7 is easy with the usual command:
ln -s
The answer is setting up Cygwin with the required packages such as
make
, etc.Read the requirements clearly: Android NDK
您可以尝试使用“mklink”而不是“ln -s”,正如 Tony O'Hagan 在 Git Bash shell 无法创建符号链接的答案。
You may try to use "mklink" instead of "ln -s" as Tony O'Hagan suggested in an answer to Git Bash shell fails to create symbolic links.
我们遇到了类似的问题,并且有一个解决方案未记录在以前的答案中。
我们需要一种方法来创建一个适用于 Cygwin 和 Windows 7 的远程目录远程链接 Samba (Linux) 共享。
我们在 Windows PowerShell 中使用了此命令,并且它有效。
上面的命令创建了一个在两者中都有效的链接。
当然,请更改本地和远程目录以满足您的需要。
ln -s 适用于 Cygwin,但不适用于 Windows。
在 Windows 资源管理器(文件夹视图)中使用“make link”命令可以在 Windows 中使用,但不能在 Cygwin 中使用。
在 Cygwin 中输入与上面类似的命令不起作用,我们不完全理解原因。可能与字符串或路径的转换有关。
We had a similar problem and had a solution not documented in previous answers.
We needed a way to create a directory remote link that worked for both Cygwin and Windows 7 to a remote Samba (Linux) share.
We used this command in Windows PowerShell and it worked.
The above command makes a link that works in both.
Of course, please change the local and remote directories to meet your needs.
ln -s works in Cygwin, but not Windows.
Using a "make link" command in Windows Explorer (folder view) worked in Windows, but not in Cygwin.
A similar command as above entered in Cygwin did not work and we didn't completely understand why. Perhaps it is related to conversion of strings or paths.