14.04 - GCC Fatal error output: no such file - Ask Ubuntu


i been trying compile c file

gcc filename.c -o outputfilename

but gcc gives

gcc: error: no such file or directory
gcc: fatal error: no input files
compilation terminated.

i changed file permission 777 made sure current working directory same place file. , made sure c source code(text/x-csrc) file type.

i run test you:

 $ gcc main.c -o test2  $ ./test2 number`s = 13 string = 13 

what files in 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 *.c files in working directory, 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 work dir correct, use cd command change current dir, more in "man cd"
  2. start use make utill
  3. you don't need give *.c files exec permission

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User