This is a mistake in processing the command line space; it is not (at least on the latest NVIDIA platforms) working as a standard Unix command line (or at least Windows).
I tried putting a lot of curly braces, including \' \" \\" \\' and the back of ` . I even tried to escape from the space itself ( -D OutputType=unsigned\ char ). This does not help, the command line is probably just chopped into tokens based on the positions of the spaces, and nobody seems to care about curly braces.
One solution is to read the source code in a line and prefix it with a single line:
#define OutputType unsigned char
There is, however, one simpler solution. You need to include the following macros in your files:
And then you can use any of:
status = clBuildProgram(output_program, 1, devices, "-D OutputType=MKTWOWORD(unsigned,char)", 0, 0); status = clBuildProgram(output_program, 1, devices, "-D OutputType=MKTWOWORD(unsigned,int)", 0, 0); status = clBuildProgram(output_program, 1, devices, "-D OutputType=MKTWOWORD(signed,int)", 0, 0); status = clBuildProgram(output_program, 1, devices, "-D OutputType=int", 0, 0);
The advantage is that you should only perform line processing on the command line, and not on the entire source code.
This is a bummer, but getting the MKTWOWORD macro inside the source code using the -D option is not possible, as this will lead to a chiken-or-egg problem. You just have to include this in your kernels.