cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

jacob
Journeyman III
Journeyman III

Preprocessor command line -D definition containing commas

Jump to solution

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 Kudos
Reply
1 Solution

Accepted Solutions
himanshu_gautam
Grandmaster
Grandmaster

Re: Preprocessor command line -D definition containing commas

Jump to solution

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

View solution in original post

0 Kudos
Reply
2 Replies
himanshu_gautam
Grandmaster
Grandmaster

Re: Preprocessor command line -D definition containing commas

Jump to solution

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

View solution in original post

0 Kudos
Reply
jacob
Journeyman III
Journeyman III

Re: Preprocessor command line -D definition containing commas

Jump to solution

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

0 Kudos
Reply