define class functions in cu files does nvcc support c++?

Sounds like I can not define a member function of a class in cu file. Although the compiling is OK, when I link, there is error message showing that the defined symbol can not be found. I’m sure the object file from the cu files are linked when linking.

Am I right that in cu file, one can not define class member function? Or I missed anything?

Thanks in advance for your help.


I assume you are talking about host code, right? This has to be C-style linkage. C++ class member functions will have C++ name mangling. So the name will be augmented by these magic prefix characters and therefore is different from the C name. Try global static functions that forward to the class member.


Note that this release of CUDA doesn’t have full support for C++.

Peter and Cyril,

Thank you for your clarification. I’ll change the C++ to C per your suggestion.