Why does it makes sense to define ideal gas specific heat only when heat can be written as the variation of a state function of temperature only? I found on textbook the following comment about ideal gas specific heat.

The definition of ideal gas specfic heat:
  $$c=\frac{1}{n} \frac{dQ}{dT}$$
  makes sense only if the heat exchanged by the gas can be written ad the variation of a state function that is only a function of temperature.

Indeed for an ideal gas, one defines $c_v$ (at constant $V$) and $c_p$ (at constant $p$), where, rispectively, in isochoric and isobaric process we have $Q=\Delta U(T)$ or $Q=\Delta H(T)$ so
$$c_v=\frac{1}{n} \frac{dU(T)}{dT}  \,\,\,\, \mathrm{and}  \,\,\,\,\, c_p=\frac{1}{n} \frac{dH(T)}{dT} $$
Nevertheless I do not get the theoretical reason why it would not make sense to define $c$ even when $Q$ is not a state function of temperature only. What are the reasons for saying that?
 A: For a gas, the quantities H, U, T, P, V, and n only have three degrees of freedom between them. If you fix three of them, the other three will be determined by the properties of the gas. First thing most analyses do is reduce the degrees of freedom by either setting n as a constant, or dividing all the quantities by it* so you only have to worry about five** variables, and two degrees of freedom. Two degrees of freedom can be visualized nicely as a surface of allowed states embedded in a higher dimensional volume.
Heat capacity is trying to define the relationship between temperature and energy. As you move along this allowed surface, since there's two degrees of freedom you can move in a large number of directions, and for each direction you choose the relationship between temperature and energy is different. So while it would be possible to define the relationship in every direction, the same information can be captured by just specifying two directions of travel and defining the relationship as your state moves in those directions. Since we like to keep things simple, the two directions scientists chose to standardize on are the directions that correspond to a constant volume, and a constant pressure.
* Usually they divide by the molecular mass as well, resulting in specific quantities
** There are of course other quantities of interest that might also be included
A: In freshman physics, we learned that, when heat is added to a constant volume system, we can write Q = CΔT, where C is called the heat capacity.  However, when we got more deeply into the basics and learned thermodynamics, we found that this elementary approach is no longer adequate (or precise).  We found that Q depends on process path and that, if work W is occurring, this changes things.  However, we still wanted C to continue to represent a physical property of the material being processed, and not to depend on process path or whether work is occurring.  This is dealt with in thermodynamics by changing the definition of C a little.  Rather than associating C with the path dependent heat Q, in thermodynamics, we associate C with parameters relating to the state of the material being processed, in particular internal energy U and enthalpy H.   We define the heat capacity at constant volume $C_v$ as the derivative of the internal energy U with respect to temperature at constant volume:
$$C_v=\left(\frac{\partial U}{\partial T}\right)_v\tag{1}$$
We also found that we could define a heat capacity at constant pressure $C_p$ as the derivative of the enthalpy H with resepct to temperature at constant pressure:$$C_p=\left(\frac{\partial H}{\partial T}\right)_p\tag{2}$$
The question is, "do either of these definitions reduce to the more elementary version from freshman physics under any circumstances."  The answer is "yes."  From the first law of thermodynamics, we find that, for a closed system of constant volume (no work being done), $Q=\Delta U=C_v\Delta T$, and, for a closed system experiencing a constant pressure change (with $W=p\Delta v$), $Q=\Delta H=C_p\Delta T$.  Of course, Eqns. 1 and 2 are much more generally applicable than this.
