C ++ Keywords for CUDA C Code

I use CUDA to speed up some parts of program C. This program uses some C ++ keywords as identifiers, so it does not compile as C ++. Now that I have changed it using CUDA, how can I compile it using NVCC?

For example, I get an error message:

table.h(65): error: expected an identifier 

when compiling the code:

 struct sw_table_position { unsigned long private[4]; }; 

This is a perfectly valid C, but invalid C ++. I am using CUDA 5.

+4
source share
1 answer

NVCC compiles C ++ code, not C code . Even if it pretends to consume C code, in fact you just get more C-like behavior, not a C compiler ( see this post ). For this reason, private is a keyword and cannot be used as an identifier (like any other C ++ keyword).

Actually --host-compilation C deprecated (it should not be used with nvcc), because in reality it does not do what you expect.

+4
source

All Articles