compiler error output to a file named err

root@sunny-desktop:~/Desktop# cat test.c
#include<stdio.h>
void dive()
{
    int a = 0
    int b = 12 / a;
}

void main()
{
    dive();
    printf("aaf");
}

root@sunny-desktop:~/Desktop# gcc test.c 2>err

root@sunny-desktop:~/Desktop# cat err
test.c: In function ‘dive’:
test.c:5: error: expected ‘,’ or ‘;’ before ‘int’

root@sunny-desktop:~/Desktop#

你可能感兴趣的:(function,File,gcc,compiler,output)