TransWikia.com

GCC Fatal error output: no such file

Ask Ubuntu Asked by user2483829 on October 16, 2020

I been trying to compile a c file with

gcc filename.c -o outputfilename

but gcc gives

gcc: error: No such  file or directory<br>
gcc: fatal error: no input files<br>
compilation terminated.

I changed the file permission to 777.

I made sure that my current working directory is the same place as the file.
And I also made sure that it is a C source code(text/x-csrc) file type.

One Answer

i run this test like you:

 $ gcc main.c -o test2
 $ ./test2
this is your number`s = 13 with string = 13

what files in my folder:

 $ ls -l
-rw-r--r-- 1 dan dan  401 Окт 15 00:54 main.c
-rw-r--r-- 1 dan dan  204 Окт 12 00:01 main.h
-rw-r--r-- 1 dan dan 1984 Окт 15 00:54 main.o
-rwxr-xr-x 1 dan dan 8720 Ноя  3 00:09 test2

gcc look *.c files only in working directory, so to check this:

 $ pwd
/home/dan/git/C/test1

and lets run compile in wrong directory:

 $ cd ..
 $ pwd
/home/dan/git/C
 $ gcc main.c -o test2
gcc: error: main.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
  1. so make sure your work dir is correct, use CD command to change you current dir, more in "man cd"
  2. start to use MAKE utill
  3. you don't need give *.c files exec permission

Answered by Zulljon on October 16, 2020

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