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?
-
2Possible duplicate of http://stackoverflow.com/questions/18654162/enable-native-ntfs-symbolic-links-for-cygwin – PJTraill May 24 '16 at 15:32
-
@PJTraill , this question may be about symlinks in Cygwin in general and not about windows native ones. – Victor Yarema Feb 14 '20 at 12:53
4 Answers
In short, define the following environment variable:
CYGWIN=winsymlinks:nativestrict
According to Cygwin documentation:
If set to
winsymlinks:native
orwinsymlinks:nativestrict
, Cygwin creates symlinks as native Windows symlinks on filesystems and OS versions supporting them.The difference between
winsymlinks:native
andwinsymlinks:nativestrict
is this: If the filesystem supports native symlinks and Cygwin fails to create a native symlink for some reason, it will fall back to creating Cygwin default symlinks withwinsymlinks:native
, while withwinsymlinks:nativestrict
thesymlink(2)
system call will immediately fail.
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.
-
2$ export CYGWIN="winsymlinks:nativestrict" worked for me in Windows 8 – aqavi_paracha Jan 05 '16 at 08:30
-
1I think you would have done better to refer to your own Question+Answer at http://stackoverflow.com/questions/18654162/enable-native-ntfs-symbolic-links-for-cygwin ! – PJTraill May 24 '16 at 15:33
-
3Using `CYGWIN=winsymlinks:native` is wrong for so many different workflows. If you are OK with using "fall back to creating Cygwin default symlinks" then why would you even try to make native in first place? If someone needs "native" then ... they need "native". The only proper option is "CYGWIN=winsymlinks:nativestrict"! – Victor Yarema Feb 13 '20 at 11:50
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

- 30,738
- 21
- 105
- 131

- 789
- 2
- 7
- 13
-
12
-
See the answer form olibre: the default behaviour of `ln -s` is apparently to create text files. – PJTraill May 24 '16 at 15:31
-
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.

- 30,738
- 21
- 105
- 131

- 9
- 2
-
You can find a script which makes things easier at: https://akudo.codes/2018/12/10/mklink-command-in-windows-ubuntu-wsl/ – Nikolay Andonov Jun 30 '19 at 16:14
-
`bash: mklink: command not found` in bash env that comes with git-scm – Jerry Green Oct 09 '21 at 20:02
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.
CMD /C MKLINK /D C:\local_dir_path\dir \\\\192.168.0.1\remote_dir_path\dir
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.

- 30,738
- 21
- 105
- 131

- 1
- 2