获取“访问被拒绝"尝试从命令行使用 g++ 编译时.赛格温

2022-01-23 00:00:00 gcc cygwin g++ c++

我已经在 cygwin 中安装了所有软件包.我还将 C:cygwinin 添加到我的 PATH 变量中.但是当我尝试在命令行中编译一个 c++ 文件时,我收到错误访问被拒绝".相同的命令在 cygwin 批处理窗口中工作.有谁知道怎么回事?

I have installed all packages in cygwin. I have also added C:cygwinin 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?

我更改了 gcc 和 g++ 的权限.我不再收到拒绝访问"错误,而是收到一个新错误:此版本的 C:cygwining++.exe 与您正在运行的 Windows 版本不兼容.请检查您计算机的系统信息以看看您是否需要 x86(32 位)或 x64(64 位)版本的程序,然后联系软件发行商.".

I changed the permissions for gcc and g++. I no longer get the 'Access Denied' error, but get a new one: "This version of C:cygwining++.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.".

推荐答案

因为c:cygwiningcc.exe不是可执行文件,所以是cygwin符号链接.p>

Because c:cygwiningcc.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'

底层文件运行良好.

C:cygwinhomeBen>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.

相关文章