Handmade Hero»Forums»Code
19 posts
day 009 : error C2100: illegal indirection ?
Edited by siska on
Hi guys,

Can you please tell me what I'm doing wrong here?
This code is from where Casey is starting to replace the square wave with a sine wave.

#define PI32 3.14159265359f;
...
real32 t = 2.0f*PI32*(real32)runningSampleIndex / (real32)wavePeriod;

The second line is not compiling ("error C2100: illegal indirection" and "warning C4552: '/': operator has no effect; expected operator with side-effect") unless I replace PI32 with 3.14159f.

I really have NO clue ... :S

Oh yeah : VS2015 + Win10.

Thanks.
504 posts
day 009 : error C2100: illegal indirection ?
remove the semicolon from the #define line

with it the second line gets expanded to:

1
real32 t = 2.0f*3.14159265359f;*(real32)runningSampleIndex / (real32)wavePeriod;


and after separating the statements:

1
2
real32 t = 2.0f*3.14159265359f;
*(real32)runningSampleIndex / (real32)wavePeriod;
19 posts
day 009 : error C2100: illegal indirection ?
Unbelievable !!!

You do not want to know how many hours I've spent trying to solve this bug :blush:

Thank you SO much !!!
Mārtiņš Možeiko
2378 posts / 2 projects
day 009 : error C2100: illegal indirection ?
Whoa. Dejavu. https://hero.handmadedev.org/foru...s-to-be-assigned-to-to-a-variable