Why does the following snippet not work with CUDA (both 3.2 and 4.0)?
#define NUM_BLOCKS 16
// lots of code.
dim3 dimBlock(NUM_BLOCKS, NUM_BLOCKS);
but this,
dim3 dimBlock(16, 16);
does?
I keep getting a error : expected a ")" and error : expected an expression. What am I missing?
Are you certain you didn't write
#define NUM_BLOCKS 16;
(note the semicolon at the end)?
I get exactly the errors you described, when the erroneus semicolon is there.
That is strange. It may be because of the usual problem with macros. If you know, macros don't respect scope. It may be that the same macro is defined elsewhere, but differently.
Why don't you use const int or enum instead of macro?
Do you know this: C++ - enum vs. const vs. #define ??
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With