- Jan 15, 2013
- 12,181
- 35
- 91
I'm including a GLSL shader in my C program using macros
Which works fine, until I declare several variables at once:
The compiler gives me an error and says I'm passing too many arguments to the TO_STRING() macro. Is there some way around this? Are there a lot of special cases where multi-line strings can't be handled in this way?
Code:
#define TO_STRING(A) #A
const char* source = TO_STRING(
void main (void)
{
// do stuff
}
);
Which works fine, until I declare several variables at once:
Code:
const char* source = TO_STRING(
void main (void)
{
float a, b, c, d; // this line generates an error
}
);
The compiler gives me an error and says I'm passing too many arguments to the TO_STRING() macro. Is there some way around this? Are there a lot of special cases where multi-line strings can't be handled in this way?