Hi guys, there is a patch to fix the compilation errors of nvidia legacy 340 drivers with kernel 5.0.5.The patch is
here, and it seems that it was written by Alberto Milone, NVIDIA driver maintainer for Ubuntu.
I've tried it and it works perfectly.Regards.