如何使cygwin的符号链接在Windows 7 [英] How to make symbolic link with cygwin in Windows 7

查看:590
本文介绍了如何使cygwin的符号链接在Windows 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我已经测试编写与本地code C / C ++的Andr​​oid应用程序。问题是,在使符号链接使用Android NDK时。一些谷歌搜索后,有人说用cygwin的。我现在已经安装了它。请告诉我如何使cygwin的符号链接在Windows 7中。

Recently I have tested to write Android application with native code C/C++. The problem is in making symbolic link when using Android NDK. After some Googling, some say to use cygwin. I have installed it now. Please tell me how to make symbolic link with cygwin in Windows 7.

先谢谢了。

推荐答案

在默认情况下 Cygwin的创建文本文件作为解决办法适用于Windows的符号链接漏洞。这些文件是不是真的符号链接。几乎所有的Windows程序并不认为这些文件作为符号链接。

Default Cygwin symlinks are just regular files

By default Cygwin creates text files as workaround for Windows symlink flaw. These files are not really symlinks. Almost all Windows programs do not considers these files as symlinks.

最近NTFS和Windows落实符号链接:

Recent NTFS and Windows implement symlinks:


  • NTFS交接点可以使用作为自NTFS 3.0(Windows 2000)的目录符号链接 LINKD 工具。

  • 使用
  • NTFS符号链接也可以作为符号链接(这两个文件和目录),因为Windows Vista中 MKLINK 工具。

  • NTFS junction point can be used as directory symlink since NTFS 3.0 (Windows 2000) using linkd or junction tools.
  • NTFS symbolic link can also be used as symlink (for both file and directory) since Windows Vista using mklink tool.

借助 Cygwin的文档说:

Cygwin的多种不同的方式可能产生的符号链接:

Cygwin creates symbolic links potentially in multiple different ways:


      
  • 默认符号链接是包含魔法饼干纯文本文件
      接着,以该连结点的路径。 [...]

  • The default symlinks are plain files containing a magic cookie followed by the path to which the link points. [...]

快捷式的符号链接[* .LNK] [...],创建
  如果环境变量CYGWIN [...]被设定为包含
  字符串winsymlinks或winsymlinks:LNK。 [...]

The shortcut style symlinks [*.lnk] [...] is created if the environment variable CYGWIN [...] is set to contain the string winsymlinks or winsymlinks:lnk. [...]

本机Windows符号链接只能在Windows Vista / 2008及更高版本创建,
  只有对文件系统支持重分析点。
  由于其怪异的限制和行为,他们只是创建
  如果用户明确地要求创建它们。
  这是通过设置环境变量进行CYGWIN
  包含字符串winsymlinks:本地或winsymlinks:nativestrict
[...]

在Cygwin:

$ export CYGWIN="winsymlinks:native"
$ ln -s -v target mylink
`mylink' -> `target'
$ echo content > target

在MinGW的:

$ cat mylink
content

CYGWIN = winsymlinks:nativestrict 更多的

nativestrict 需要创建符号链接前,目标存在。

CYGWIN=winsymlinks:nativestrict is more strict

nativestrict requires the target exists before the symlink creation.

在Cygwin例如:

$ export CYGWIN="winsymlinks:nativestrict"
$ rm -f  a b
$ ln -sv a b
ln: failed to create symbolic link `b': No such file or directory
$ touch    b
$ ln -sv a b
ln: failed to create symbolic link `b': File exists
$ rm b
$ touch a
$ ln -sv a b
`b' -> `a'

这篇关于如何使cygwin的符号链接在Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆