Optimal resource allocation for cooperative cognitive radio networks with opportunistic access to the licensed spectrum is studied. Resource allocation is based on minimizing the symbol error rate at the receiver. Both the cases of all-participate relaying and selective relaying are considered. The objective function is derived and the constraints are detailed for both scenarios. It is then shown that the objective functions and the constraints are nonlinear and nonconvex functions of the parameters of interest, that is, source and relay powers, symbol time, and sensing time. Therefore, it is difficult to obtain closed-form solutions for the optimal resource allocation. The optimization problem is then solved using numerical techniques. Numerical results show that the all-participate system provides better performance than its selection counterpart, at the cost of greater resources.