AnswerBun.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!

Related Questions

Sound not working Focal Fossa Ubuntu 20.04

2  Asked on November 19, 2021 by dipanshu-verma

         

Can’t install Ubuntu RST and Intel Optane problem

0  Asked on November 19, 2021 by thewiredguy

   

Cant install ubuntu server 18.04

0  Asked on November 19, 2021 by beistmaster

   

Choppy Video Playback with Intel GMA-500 Chipset

1  Asked on November 18, 2021 by seyed-mohammad

         

How do I let Ubuntu find the install path for tcl?

1  Asked on November 18, 2021 by eli-sander

       

Ubuntu 18.04 fails to boot after installing graphics drivers

1  Asked on November 18, 2021 by matthew-naybour

     

Dual boot with Ubuntu and Windows on separate disk

5  Asked on November 18, 2021 by confubuntu

       

How do I remove the glow on plank dock when an app is focused on?

0  Asked on November 18, 2021 by yurishizu

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir