TransWikia.com

gcc: fatal error: no input files

Super User Asked by PCheck on December 29, 2021

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("Hellon");

  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

The problem was that I had followed the instructions on the following page: https://github.com/is1200-example-projects/mcb32tools/releases/ 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)"

Answered by PCheck on December 29, 2021

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

Answered by Giovana Morais on December 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP