I’m a new CUDA programmer. The following code can be done in C but I get an error with nvcc.
typedef struct {
unsigned long nn;
} myS;
typedef struct myS* mySPtr; /* error: invalid redeclaration of type name “myS” */
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Thu_Nov__4_13:45:48_PDT_2010
Cuda compilation tools, release 3.2, V0.2.1221
The reason there is a difference between CUDA and C here is because CUDA processes the code according to C++ rules. g++ gives an essentially identical error to CUDA:
typedef.cpp:8: error: using typedef-name ‘myS’ after ‘struct’
typedef.cpp:6: error: ‘myS’ has a previous declaration here
typedef.cpp:8: error: invalid type in declaration before ‘;’ token