cuda errors in compilation with cutil.cpp

I have some problem with compilation on CUDA. I tried on cuda3 and cuda4 (because this project was written for these versions), gcc ver 3.4 and got these errors:

/home/susers/s218176/cuda4/C/lib//libcutil_x86_64.a(cutil.cpp.o): In function (anonymous namespace)::loadPPM(char const*, unsigned char**,
      unsigned int*, unsigned int*, unsigned int*)':
      cutil.cpp:(.text+0x184): undefined reference to
      std::basic_ostream >& std::__ostream_insert

        (std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x224): undefined reference to std::ctype<char>::_M_widen_init() const' cutil.cpp:(.text+0x2b7):
            undefined reference tostd::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x2f7): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x33f): undefined reference to
            std::ctype::_M_widen_init() const' /home/susers/s218176/cuda4/C/lib//libcutil_x86_64.a(cutil.cpp.o): In function CUTBoolean (anonymous namespace)::cutWriteFile<float>(char
            const*, float const*, unsigned int, float, bool)':
            cutil.cpp:(.text+0x1a87): undefined reference to
            std::basic_ostream >& std::__ostream_insert (std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x1ae1): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x1af3): undefined reference to
            std::basic_ostream >& std::basic_ostream ::_M_insert(double)' cutil.cpp:(.text+0x1b07): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x1b5b): undefined reference to
            std::basic_ostream >& std::basic_ostream ::_M_insert(double)' cutil.cpp:(.text+0x1b72): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x1baa): undefined reference to
            std::basic_ostream >& std::__ostream_insert (std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x1bd4): undefined reference to std::ctype<char>::_M_widen_init() const' cutil.cpp:(.text+0x1c4a):
            undefined reference tostd::ctype::_M_widen_init() const' /home/susers/s218176/cuda4/C/lib//libcutil_x86_64.a(cutil.cpp.o): In function CUTBoolean (anonymous namespace)::cutWriteFile<double>(char
            const*, double const*, unsigned int, double, bool)':
            cutil.cpp:(.text+0x20c7): undefined reference to
            std::basic_ostream >& std::__ostream_insert (std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x2121): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x2130): undefined reference to
            std::basic_ostream >& std::basic_ostream ::_M_insert(double)' cutil.cpp:(.text+0x2144): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x2198): undefined reference to
            std::basic_ostream >& std::basic_ostream ::_M_insert(double)' cutil.cpp:(.text+0x21af): undefined reference to std::basic_ostream<char, std::char_traits<char> >&
            std::__ostream_insert<char, std::char_traits<char>
            (std::basic_ostream<char, std::char_traits<char> >&, char const*, long)' cutil.cpp:(.text+0x21e3): undefined reference to
            std::basic_ostream >& std::__ostream_insert (std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x220c): undefined reference to std::ctype<char>::_M_widen_init() const' cutil.cpp:(.text+0x2282):
            undefined reference tostd::ctype::_M_widen_init() const' /home/susers/s218176/cuda4/C/lib//libcutil_x86_64.a(cutil.cpp.o): In function (anonymous namespace)::savePPM(char const*, unsigned char*,
            unsigned int, unsigned int, unsigned int)': cutil.cpp:(.text+0x25e5):
            undefined reference tostd::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)' cutil.cpp:(.text+0x2724): undefined reference to `std::ctype::_M_widen_init() const'

There is much more errors like this. What’s wrong with this cuda? My compilation command:

/home/susers/s218176/cuda4/cuda/bin/nvcc -O3 -use_fast_math -DUSING_CUDA -DKERNEL_ORG -D_NOT_USING_MPI -I/home/susers/s218176/cuda4/cuda/include/ -I/home/susers/s218176/cuda4/cuda/samples/common/inc/ -I/home/susers/s218176/cuda4/C/common/inc/ -L/home/susers/s218176/cuda4/C/lib/ -L/home/susers/s218176/cuda4/cuda/lib64/ -lcutil_x86_64 -lcudart -lm --ptxas-options=-v -gencode=arch=compute_13,code=sm_13 -gencode=arch=compute_13,code=compute_13 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_20,code=compute_20 mcgpu.cu -o mpgpu.x -D__STRICT_ANSI__

If I remove -lcutil_x86_64 then I’m getting only few errors like this: tmpxft_000057e5_00000000-4_mcgpu.compute_13.cudafe1.cpp:(.text+0x47a6): undefined reference tocutCreateTimer’` but it’s still some problem with this cutil.cpp

Maybe there is something wrong in my command or somewhere else. Please help.

Use gcc 4.1.2 such as was already suggested to you.

Ok, here we go, another errors:

n file included from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:464:17: error: cmath: No such file or directory
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:465:19: error: cstdlib: No such file or directory
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:484:1: warning: "signbit" redefined
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:462,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/usr/include/math.h:225:1: warning: this is the location of the previous definition
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:486:1: warning: "isfinite" redefined
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:462,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/usr/include/math.h:237:1: warning: this is the location of the previous definition
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:491:1: warning: "isnan" redefined
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:462,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/usr/include/math.h:253:1: warning: this is the location of the previous definition
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:493:1: warning: "isinf" redefined
In file included from /home/susers/s218176/cuda3/cuda/bin/../include/math_functions.h:462,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/common_functions.h:102,
                 from /home/susers/s218176/cuda3/cuda/bin/../include/cuda_runtime.h:62,
                 from <command line>:1:
/usr/include/math.h:265:1: warning: this is the location of the previous definition

I tried on CUDA3 and 4 and the same.

edit: actually I used gcc version 4.1.3 20080704 (prerelease) (Ubuntu 4.1.2-27ubuntu1) because I couldn’t find 4.1.2