strange problem in compilation

Hello everybiody, this is my problem,
sometimes when I compile a cuda-mexfile i get the error “” what is invalid device function ()", or " what is bad allocation()" ?
I don’t understand the problem,
any suggestion?
Thanks in advance

copy paste exactly what you are doing together with the output.