Need help with compile error

I have just installed Rust and create the first program "Hello World". When I compile it, I got below error with gcc. I use Windows 10 64 bits with Cygwin. Please tell me how to fix it.

Thanks in advance.

Thang@Thang-Laptop ~/rust_projects/hello_world
$ gcc --version
gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Thang@Thang-Laptop ~/rust_projects/hello_world
$ rustc main.rs
error: could not exec the linker `gcc`: Access is denied. (os error 5)
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "main.0.o" "-o" "main.exe" "main.crate.allocator.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-032e1c452e2de4d1.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-af7b1e134ab5ede1.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-8432a2d911f96a2f.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-f4544e7032568897.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-4af742a168c01de9.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_unicode-e2b4d8b13c8cf98f.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-8115485dc2a7ae72.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-863fb1f3088fad80.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-6fe1fb0e133236a4.rlib" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-297864ab139f9899.rlib" "-Wl,-Bdynamic" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\cygwin64\\usr\\local\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"

error: aborting due to previous error

I think it would be helpful to know what version of rust (rustc --version) and how you installed rust (did you use rustup, for example)

The version is

Thang@Thang-Laptop ~/rust_projects/hello_world
$ rustc --version
rustc 1.21.0 (3b72af97e 2017-10-09)

I installed by ran the install command on cygwin

Thang@Thang-Laptop ~/rust_projects/hello_world
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
rustup: gpg not available. signatures will not be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
rustup: installing toolchain for 'stable'
rustup: extracting installer
install: uninstalling component 'rustc'
install: uninstalling component 'cargo'
install: uninstalling component 'rls-preview'
install: uninstalling component 'rust-analysis-x86_64-pc-windows-gnu'
install: uninstalling component 'rust-docs'
install: uninstalling component 'rust-std-x86_64-pc-windows-gnu'
install: uninstalling component 'rust-mingw'
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'cargo'
install: installing component 'rls-preview'
install: installing component 'rust-analysis-x86_64-pc-windows-gnu'
install: installing component 'rust-docs'
install: installing component 'rust-std-x86_64-pc-windows-gnu'
install: installing component 'rust-mingw'

    Rust is ready to roll.

I did install MinGW on Windows directly then I recognized that I should install from cygwin package, so I installed on Cygwin then uninstall MinGW.

Thank you.