You don't mention your distro, so I will assume that it's an RPM-based one.
Do an rpm -qa | grep source
, and then a uname -r
. Make sure that the versions of both of these match.
However, it appears from these messages:
In file included from /lib/modules/2.4.18-18.8.0/build/include/linux/config.h:4
that your kernel-source package is including the wrong autoconf.h file. You can also try an export BUILD_PARAMS="-nostdinc -I/usr/lib/gcc-libi686-pc-linux-gnu/<gcc version here>/include"
if you're using gcc 3 (though you can try it if you're not as well, I just don't know if gcc 2 recognizes the -nostdinc option), before running make. This will add those flags to the cc command line, which might help.
If all else fails, then you might be able to fix it with a kernel reconfigure. Do a make mrproper
from the base of the kernel-source directory, then find the config file that matches your hardware and the kernel that you have installed (on RH, it's in the configs/ directory under the kernel-source), copy it to <kernel-source base>/.config, and run make oldconfig dep
from the base of kernel-source. Then try the NVIDIA_kernel again.