写一个makefile文件,如下 include ${PETSC_DIR}/conf/variables include ${PETSC_DIR}/conf/rules all: FillUpMatrix.o Demo1.o Demo2.o ex36f.o ${FLINKER} -o ex36 FillUpMatrix.o Demo1.o Demo2.o ex36f.o ${PETSC_LIB} ${PETSC_MAT_LIB} ${PETSC_FORTRAN_LAB} 然后 make all 运行同MPI程序