linux - I'm trying to write a shell command to find and compile all C programs -


i'm trying write shell command find , compile c programs

  find . -type f -name '*.c' -exec sh -c 'gcc {} -o $(dirname {})/$(basename {} .c)' \; 

is have now, , compile c files, returns these errors.

/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o: in function `_start': (.text+0x20): undefined reference `main' collect2: error: ld returned 1 exit status 

i'm stuck , appreciated.

you don't have main defined c file/files. check individual inclusions trying create separate executable each of c file. want show #include of compiled files.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -