获取“访问被拒绝”当试图从g ++编译从命令行。 Cygwin [英] Get "Access is denied" when trying to compile with g++ from command line. Cygwin

查看:225
本文介绍了获取“访问被拒绝”当试图从g ++编译从命令行。 Cygwin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了cygwin中的所有软件包。我还添加了C:\cygwin\bin到我的PATH变量。但是当我尝试在命令行中编译一个c ++文件时,我得到错误访问被拒绝。相同的命令在cygwin批处理窗口中工作。

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?

编辑:我更改了gcc和g ++的权限。我不再得到访问被拒绝错误,但得到一个新的:这个版本的C:\cygwin\bin\g ++。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:\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.".

推荐答案

因为 c:\cygwin\bin\gcc.exe 不是可执行文件,它是一个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'

底层文件运行正常。

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.

这篇关于获取“访问被拒绝”当试图从g ++编译从命令行。 Cygwin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆