I am using CUDA to accelerate some parts of a C program. This program makes use of some C++ keywords as identifiers, so it doesn't compile as C++. Now that I changed it with CUDA, how can I compile it with NVCC?
For instance, I get the error:
table.h(65): error: expected an identifier
when compiling the code:
struct sw_table_position {
unsigned long private[4];
};
Which is perfectly valid C, but invalid C++. I am using CUDA 5.
NVCC compiles C++ code, not C code. Even if it pretends to consume C code in reality you just get a more C-like behavior, not a C compiler (see this post). For this reason private
is a keyword and can't be used as identifier (like any other C++ keyword).
Actually --host-compilation C
is deprecated (it shouldn't be used with nvcc) because in reality it doesn't do what you expect.