Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

gcc: fatal error: no input files

Writer Sebastian Wright

I wrote this simple line of code and saved it in a file called 'ex.c'. The code is the following (first line is purposely written wrong as it showed up different in the post):

"#include < stdio.h >
int lst[] = {6,3,7,9};
int main(){ printf("Hello\n"); return 0;
}

I then wanted to compile it using the command gcc ex.c but I get an error saying "gcc: fatal error: no input files compilation terminated."

What am I doing wrong? I use git bash and have installed both msys64 and MinGW to the C directory, aswell as add the gcc in my path enviorment.

Why is it not working?

2 Answers

you should add the output executable name

gcc ex.c -o output and then you can execute your output file with /output.

all the other options are available in the gcc documentation

13

The problem was that I had followed the instructions on the following page: But I had forgot the last step which is to download the .run file for msys, I did this and now it is working for MSYS2, Git Bash still not working, but one working is all I need!

STEPS I FORGOT (as taken from the link):

  • Download the .run-file for windows. Make sure you download the correct version. The x86_64 version is for 64 bit MSYS2 installation and the i686 version for a 32 bit MSYS2 installation.

  • Run the .run-file inside the MSYS2 environment (cd to containing directory, run with ./mcb32tools-*.run)"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy