Unknown cause for error
May 25, 2014 at 2:22pm UTC
I do not know what is causing these errors:
1 2 3 4
error: expected primary-expression before '(' token
error: expected primary-expression before '(' token
error: expected primary-expression before '(' token
error: expected primary-expression before ')' token
The code that causes the errors is as follows
1 2 3 4
Matrix4x4<T> r(Vector4<T>((2/(right - left)), 0, 0, -((right + left)/(right - left))),
Vector4<T>(0, 2/(top-bottom), 0, -((top + bottom)/(top - bottom))),
Vector4<T>(0, 0, (-2)/(far - near), (far + near)/(far - near)),
Vector4<T>(0, 0, 0, 1));
What makes it even stranger is that this code compiles:
1 2 3 4
Matrix4x4<T> r(Vector4<T>(1, 1, 1, 1),
Vector4<T>(1, 1, 1, 1),
Vector4<T>(1, 1, 1, 1),
Vector4<T>(1, 1, 1, 1));
Any help would be greatly appreciated.
May 25, 2014 at 2:43pm UTC
That is strange. It compiles for me.
Can you point at exactly which parenteses error messages are pointing?
May 25, 2014 at 2:53pm UTC
Maybe you're reusing your variable names for something else like a #define Macro? Check your global space, or better yet use ctrl+f to search the code for instances of these variable names.
May 25, 2014 at 4:10pm UTC
Are you dividing by 0 somewhere?
May 25, 2014 at 6:15pm UTC
Dividing by zero does not produce compile-time errors.
May 26, 2014 at 10:03am UTC
@Computergeek01 I think you are correct, I changed the variable names and the code compiled! I cannot however find any place where I have created a #define for those variables. I will keep searching.
Topic archived. No new replies allowed.