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

后端 未结 4 1519
感动是毒
感动是毒 2020-12-15 05:08

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

相关标签:
4条回答
  • 2020-12-15 05:14

    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.
    
    0 讨论(0)
  • 2020-12-15 05:23

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

    0 讨论(0)
  • 2020-12-15 05:31

    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.

    0 讨论(0)
  • 2020-12-15 05:33

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

    0 讨论(0)
提交回复
热议问题