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

2020-07-03 04:20发布

问题:

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!

回答1:

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



回答2:

Then you must go to System properties, System variables, and append the path to "C:\cygwin64\bin" in PATH



回答3:

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.



回答4:

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.



回答5:

when selecting packages at installation or update search for 'gcc' in searchbox and select the boxes showing 'gcc' mostly found in devel package.



回答6:

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.



标签: c cygwin