cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

jacob
Journeyman III

Preprocessor command line -D definition containing commas

Hello,

I'm trying to pass the following string to the OpenCL compiler using the fourth parameter of the function clBuildProgram

-DNUMBERS=0,1,2,3

so that I can use the macro NUMBERS to initialize a constant static array in the code,

const int numbers [] = { NUMBERS };

This is something that certainly works with GNU C preprocessor; however, here I'm getting error

Catastrophic error: cannot open source file "1"

I tried enclosing the numbers in quotation marks, -DNUMBERS="0,1,2,3", which passes the string "0,1,2,3" really as a string, and that is unusable for my purpose. Is there any workaround for such command-line definition?

Thank you for any suggestion!

Jakub

0 Likes
1 Solution
himanshu_gautam
Grandmaster

Give space inbetween -D and Macro name like -D Numbers=1,2,3,4

View solution in original post

0 Likes
2 Replies
himanshu_gautam
Grandmaster

Give space inbetween -D and Macro name like -D Numbers=1,2,3,4

0 Likes

Thank you very much -- adding a space did solve the problem.

0 Likes