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

2020-07-03 03:54发布

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!

标签: c cygwin
6条回答
Explosion°爆炸
2楼-- · 2020-07-03 04:34

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

enter image description here

查看更多
狗以群分
3楼-- · 2020-07-03 04:39

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.

enter image description here

查看更多
Root(大扎)
4楼-- · 2020-07-03 04:44

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

查看更多
Root(大扎)
5楼-- · 2020-07-03 04:45

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.

查看更多
来,给爷笑一个
6楼-- · 2020-07-03 04:47

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

查看更多
在下西门庆
7楼-- · 2020-07-03 04:49

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.

查看更多
登录 后发表回答