Set an environment variable to this PGLIB=/usr/local/pgi-3.3.1/linux86/lib command line works g++ -o test_mpi -I $MPIROOT/include test_mpi.cc $MPIROOT/lib/libmpich.a -L $MPIROOT/lib -L $PGLIB -lmpich -lmpe -lpmpich -lstdc++ -lpgc