I read two different definition of projective dimension of a complex $M$ The first (given by foxby) is: $$\operatorname{pd}_R M= \inf_P \sup\{\, n\,|\,P_n\neq 0\,\}$$ And the second definition is: the projective dimension of $M$ is the smallest integer $n>-1$ with the property $\operatorname{Ext}^{n+1}(M,-)=0$. If no such integer exists then it is $\infty$.
Are those two definition the same? How to prove it?
The definitions agree provided you are only interested in $\text{Ext}^{n+1}(M,N)$ vanishing for all $R$-modules, rather than all $R$-complexes.
Let $$\text{pd}_{R}(M) = \inf_{P}\sup\{n:P_{n}\neq0\}$$ denote the projective dimension of the complex $M$, where the $P$ runs over all DG-projective complexes quasi-isomorphic to $M$. This is your first definition.
We then have the following (slightly abbreviated) theorem from Avramov and Foxby's paper Homological dimensions of unbounded complexes:
This then gives you the equivalence between your definitions, or at least the relationship between Ext-vanishing and projective dimensions.