简体   繁体   中英

GNU mingw compiler error: sh: gcc: command not found

I have downloaded the GNU compiler using the instructions online. Whilst compiling, I keep on getting the following error:

sh: gcc: command not found

I have tried to search online, but I have has no luck. Does anybody know why this is occurring, or how to fix it?

PS I have the mingw folder saved in C:\\mingw and I am using the msys.bat compiler as suggested online which is located in C:\\mingw\\msys\\1.0 . The source .c file I am trying to compiler is located in D:\\cfiles\\task1 .

Thanks for your help in advance

Here is a link I found that solves this exact issue by modifying a line in the fstab.sample file (in my case this is the name). To summarize, add mount to the following line in fstab.sample like this

c:/MinGW/       /mingw   // Suggested* default line

mount c:/MinGW/ /mingw   // Fixed the "gcc:command not found" error for me

*Suggested by MinGW/MSYS installation guide and seems to be present by default in the file these days. This is an alternative solution and modifying path variables works.

Right Click on Computer. Properties. Advanced Settings. Add a new path to path variable. It should be the place of bin.

You know downloading a header file from internet isn't suitable because maybe that header file depends on other libraries and header files. So you should solve dependencies manually. Check this url and post errors.

If you just want to use complex.h for its math functions forget about it and use math.h. Code :

#include <math.h> /* In c++ : #include <cmath> */
// Use math.h functions

A usefull link for math.h

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