简体   繁体   中英

“-bash: gcc: command not found” using cygwin when compiling c?

I just installed the latest version of Cygwin ans for some reason when I try to compile code, it always flashes me this error:

-bash: gcc: command not

I also don't seem to have the gcc.exe that people are referring to and when I try installing stuff like mingw as suggested by other forum answers, it always gives me this error that ti couldn't install the repository.txt.... Looking for help on this matter!

You can install gcc by running setup-x86.exe or setup-x86_64.exe again. The gcc package is in the Devel category:

在此输入图像描述

然后你必须转到系统属性,系统变量,并在PATH中将路径追加到“C:\\ cygwin64 \\ bin”

Related issue.

I received below error:

'g++' is not recognized as an internal or external command,

Did the below to resolve:

  1. Downloaded & installed setup-x86_64.exe from https://cygwin.com/install.html
  2. selected below:
    gcc-g++: GNU Compiler Collection (C++)
    make: The GNU version of the 'make' utility
    gdb: The GNU Debugger

  3. Appended ';C:\\cygwin64\\bin' to PATH environment variable

All errors are gone.

在安装时选择软件包或更新在搜索框中搜索“gcc”并选择显示在devel软件包中的“gcc”框。

Try installing cygwin from a mirror you did not use earlier(preferably the first one). Some of the servers hold older versions of cygwin which have many problems. Also, search for gcc and install the devel package.

I had the same problem when I installed cygwin from the iitm mirror(closest to my home), and it got resolved when I reinstalled the whole thing from the cygwin mirror.

If you have already added the gcc package you want you may also need to setup a symbolic link to a different gcc.exe binary. For example:

$cd /usr/bin/
$ln -s i686-pc-cygwin-gcc.exe gcc
$which gcc
$/usr/bin/gcc

You can add the gcc package through the 'Add Package' batch file.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM