gcc: language c++ not recognized, centOS 5.6 Can't compile with nvcc in centOS 5.6

Hello,

I a relative linux newby and am having trouble with the nvcc command.

When I try to complile cuda code with nvcc I get this error: gcc: language c++ not recognized

Or more fully:
nvcc gpuAddVec.cu
gcc: language c++ not recognized
gcc: language c++ not recognized
gcc: gpuAddVec.cu: linker input file unused because linking not done
Catastrophic error: cannot open source file “/tmp/tmpxft_00002544_00000000-4_gpuAddVec.cpp1.ii”

1 catastrophic error detected in the compilation of “/tmp/tmpxft_00002544_00000000-4_gpuAddVec.cpp1.ii”.
Compilation terminated.

Here is my version of gcc:

gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/mcasey/gcc/gcc-4.3.4/configure --enable-languages=c,c++ --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions : (reconfigured) /home/mcasey/gcc/gcc-4.3.4/configure --enable-languages=fortran --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
Thread model: posix
gcc version 4.3.4 (GCC)

I had an older version of gcc (but don’t remember what it was) and I installed version 4.3.4 myself (and probably did something wrong.)

I have no problem compiling c or c++ code with gcc or g++ commands.

Also, with my old version of gcc the nvcc command worked just fine.

Any help would be greatly appreciated!
-M.

You gcc is configured to support just Fortran as its only language and thus cannot compile the C++ code that nvcc generates. If the older GCC version you already have is too old for CUDA, you need to recompile gcc with C and C++ enabled. C and C++ are enabled by default, so you don’t need to fiddle with language settings at all.