Does anyone know of a book that has mathematical definitions of a string, a $p$-brane, a $D$-brane and other related topics. All the books I have looked at don't have a precise definition and this is really bugging me.
There isn't any mathematically precise definition. These are physical objects, and they acquire their definition in a given model which allows for calculations. The same physical object can appear in different models in different roles, so the strings have different mathematical definition in different limits of the full M-theory.
The closest thing to a mathematical definition of a (perturbative) string is a 2d conformal field theory which reproduces a space-time scattering from the correlation functions of the 2d theory. This is the 1980s definition, and it is only valid in the limit that the strings are perturbative, near zero coupling. In the same limit, the definition of a d-brane in the weak coupling limit is a surface on which the strings can have endpoints. This can be all of spacetime, in which case you have strings that can be perturbatively open or closed, a type I theory.
These definitions are not exactly definitions, but identifications of a physical object, because the mathematical description changes character at strong coupling. For type IIA strings, they turn into membranes at strong coupling, type IIB strings turn into IIB d-branes, and the perturbative description leaves out processes where d-branes are formed and annihilate, which are nonperturbative in the string coupling expansion, because the brane tension diverges at small coupling.
Th dualities, and the lack of a single unified formalism from which to derive all such dualities, make it impossible to formulate strings as a single mathematical object. It's a physical theory, with the additional handicap that all the physical intuition is derived from calculations and low-energy/classical limits, because we can't actually directly observe the strings. That doesn't turn it into mathematics, it's still physics, and you still need good physical intuition.