error: extra text after expected end of preprocessing directive
#if defined X or defined Y
^
It compiles fine with the Intel SDK.
Can you please explain in some more detail. Also mention your system details: CPU,GPU,SDK,Driver&OS.
Some time back i had encountered a similar bug and reported to developers, it might be the same issue again.
Ubuntu 10.04, amd-app-sdk-v2.4-lnx64, Cypress GPU
When compiling I add options "-DX -DY", then I do:
#if defined X or defined Y
...
And get a compile error (only with AMD SDK, not Intel).
My workaround looks like this:
#ifdef X
#define XY
#elif defined Y
#define XY
#endif
#ifdef XY
...
Tasp,
Can you try running matrixMultiplication Double sample on your system for both GPU & CPU? This sample also declares preprocessor definitions at build time.
Yes the sample works but it has nothing to do with my problem as far as I can see. I'll try to explain it again:
Example in c:
#include <stdio.h>
#define Y
int main(int argc, char* argv[])
{
#if defined X or defined Y
printf("Test1\n");
#endif
#if defined X || defined Y
printf("Test2\n");
#endif
return 0;
}
I expected both constructs to work in OpenCL but only the second one works.
So:
in any kernel >>>> ERROR
#if defined X or defined Y
is ok
#if defined X || defined Y
Just for completeness, it's defined in here http://en.wikipedia.org/wiki/Iso646.h and part of the C standard.
Reading the Wikipedia article, it appears that or is mapped to || in iso646.h. It's only defined in the language in C++98, but OpenCL is based on C99. As such, if you wanted to use or instead of ||, you would need this header file which doesn't exist.