The first element of the argv
array passed to execvp
(i.e., the second argument passed to execvp
) should be (just like with the argv
array passed to the main
function of any C program) the name of the program being executed, with the element after that being the first command-line argument. Thus, tab
should be:
char * tab[] = {"gcc", "file1.o", "file2.o", "file3.o", NULL };