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

僤鯓⒐⒋嵵緔 提交于 2020-06-10 08:04: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!


回答1:


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




回答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.



来源:https://stackoverflow.com/questions/25705726/bash-gcc-command-not-found-using-cygwin-when-compiling-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!