Here's the sample structure.
gcc -Idir0 main.c sum.c -o main
The command should be:
gcc -Idir0 main.c dir0/sum.c -o main
Notice that sum.c is in a sub-directory and you have to tell the compiler that.