开发者

Get "Access is denied" when trying to compile with g++ from command line. Cygwin

开发者 https://www.devze.com 2023-02-11 07:27 出处:网络
I have installed all packages in cygwin. I have also added C:\\cygwin\\bin to my PATH variable. But when I try to compile a c++ file in command line I get the error \'Access is denied\'. The same comm

I have installed all packages in cygwin. I have also added C:\cygwin\bin to my PATH variable. But when I try to compile a c++ file in command line I get the error 'Access is denied'. The same commands work in the cygwin batch window. Does anyone know what's wrong?

Edit: I changed the开发者_C百科 permissions for gcc and g++. I no longer get the 'Access Denied' error, but get a new one: "This version of C:\cygwin\bin\g++.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.".

Get "Access is denied" when trying to compile with g++ from command line. Cygwin

Get "Access is denied" when trying to compile with g++ from command line. Cygwin


Because c:\cygwin\bin\gcc.exe isn't an executable file, it's a cygwin symbolic link.

$ file /bin/gcc
/bin/gcc: symbolic link to `/etc/alternatives/gcc'
$ file /etc/alternatives/gcc
/etc/alternatives/gcc: symbolic link to `/usr/bin/gcc-4.exe'

The underlying file runs just fine.

C:\cygwin\home\Ben>gcc-4 --version
gcc-4 (GCC) 4.5.0
Copyright (C) 2010 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.


I just deleted gcc and g++ and renamed the g++/cc-4.


Unless you're a masochist, always use a Cygwin batch window with Cygwin executables. Also if you're using the Cygwin compiled gcc, you'll need the Cygwin DLL to run the results. The Cygwin website explains why. If you need executables without the Cygwin dll, I'd explore MinGW.


I got the same issue and was because I had pending the reboot after Cygwin installation. After the reboot works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消