nvcc problem with __attribute__

I’m getting the following error when I try to compile any example. I have an 8600 GTS, latest driver, latest toolkit, and OpenSuSE 10.3 beta 3. I removed the define for _GLIBCXX_VISIBILITY(V) and it seems to get past this.

gatoatigrado@oliver:~/NVIDIA_CUDA_SDK/projects/matrixMul> make

"/usr/include/c++/4.2.1/i586-suse-linux/bits/c++config.h", line 149: error:

          expected a "{"

  namespace std __attribute__ ((__visibility__ ("default"))) {


"/usr/include/c++/4.2.1/cstddef", line 53: error: expected a "{"

  namespace std __attribute__ ((__visibility__ ("default"))) {


"/usr/include/c++/4.2.1/cstdlib", line 104: error: expected a "{"

  namespace std __attribute__ ((__visibility__ ("default"))) {


"/usr/include/c++/4.2.1/cstdlib", line 161: error: expected a "{"

  namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {


"/usr/include/c++/4.2.1/cstdlib", line 203: error: expected a "{"

  namespace std __attribute__ ((__visibility__ ("default"))) {


5 errors detected in the compilation of "/tmp/tmpxft_00001570_00000000-3.ii".

make: *** [obj/release/matrixMul.cu_o] Error 255

This problem seems to be caused by the changes in gcc/g++ 4.2

(look at gcc 4.2 changes note).

What you can do is, rather than modifying system-wide header files,

(1) install gcc/g++ 4.1,

(2) create symbolic links in your CUDA bin directory to the gcc/g++ 4.1 executables,

(if you have CUDA executables installed in /path/to/your/cuda/bin)

ln -s /usr/bin/gcc-4.1 /path/to/your/cuda/bin/gcc

ln -s /usr/bin/g++-4.1 /path/to/your/cuda/bin/g++

(3) give --compiler-bindir=/PATH/TO/YOUR/CUDA/BIN option whenever you run nvcc

nvcc --compiler-bindir=/path/to/your/cuda/bin [other options] <inputfile>

This will force nvcc to use gcc/g++ 4.1 and this error will go away.

I did with CUDA 2.3 and gcc 4.3 and works fine. I think that’s the best option. Does the future versions of CUDA will be fine with gcc 4.4?

Thank you very much!!