I’m pretty sure nvcc does support C++ in the host code. Any host code is just handed off to the specified host C/C++ compiler, in my case g++. And that’s where this inner class is, way deep down buried inside of the host code for the framework I’m using (called ITK).
I think I’m going to get around this problem by just compiling my host code separately into an object file, then compile my CUDA code (host cuda commands and device kernel) with nvcc, and link the two together after compilation. There’s an example of this in the SDK (look for cppIntegration I think).
cppIntegration compiles the c++ code with g++ directly, not through the nvcc translation.
“The CUDA compiler driver NVCC” does seem to indicate that c++ host code should work, but it does not. Sure, some things will pass through properly, but most things do not. For instance, write a class with a private member variable and try compiling in device emulation mode. It doesn’t work because the translated code tries to access the private member from outside the class. Or this nested class problem you have.
It doesn’t say in the current release notes, but in a previous version of CUDA the release notes mentioned that --host-compilation=c++ is considered an alpha feature.
I have a class that contains host and device code - It uses vectors in the host code and was working previously with Cuda 2.1, now I have upgraded to Cuda 2.2, I get the errors mentioned above. What way do you suggest I get around this? I really don’t want to reorganise my code and have duplicates of everything :(
I had the same problem. Notes: I didn’t have the problem when I compiled most of my c++ code using icpc in 32-bit architecture (code that ends up being linked), but rather, it only came up when switching to 64-bit. I found some info online about nvopencc (the 64 bit NVIDIA compiler as far as I can tell) and it said that NVIDIA officially does not support c++ in 64-bit code, only accepting C. Can anyone confirm this, or to the contrary, provide hope for C++ and 64-bit code compiled/linked with nvcc?