Undefined symbols for architecture x86_64

I try to compile my source file (file.cu) with nvcc on mac OSX.
I use instruction:

$ nvcc file.cu -o file

but I get the following output

Undefined symbols for architecture x86_64:
  "std::istream::operator>>(double&)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::istream::operator>>(int&)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::ostream::operator<<(std::ostream& (*)(std::ostream&))", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::ostream::operator<<(double)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::ios_base::Init::Init()", referenced from:
      ___cxx_global_var_init in tmpxft_000002fa_00000000-16_prodotto.o
  "std::ios_base::Init::~Init()", referenced from:
      ___cxx_global_var_init in tmpxft_000002fa_00000000-16_prodotto.o
  "std::cin", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::cout", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
  "operator new[](unsigned long)", referenced from:
      _main in tmpxft_000002fa_00000000-16_prodotto.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What do I do?

Hey JacopoCinosi,

This looks like a stdlib issue. I just had a similar problem on my machine. Without knowing the specifics you might have to tell nvcc to use either libstdc++ or link -lc++.

I hope this helps

Chris :-)