I hit an issue with OCUnit the other day when I was trying to get a project of mine working correctly with it. The issue was that using the macro STAssertEqualObjects anywhere would cause the following build error:
error: parse error before ‘typeof’
After a whole lot of digging, I finally figured out what was causing this issue. I reprint it here because no-one else appears to have this documented. If you are running into this problem, go check that the selected C Language Dialect is anything besides ANSI C or some variant thereof. This includes C89 and C99. C99 does not include support for the typeof keyword, which is what is causing this error message.
My whole iRooster project was originally set to use C99 mode because it drives me nuts to not be able to declare ints inside of a for loop (like in the following syntax: for (int i=0; i<[foo length]; i++) { /* */ }.
Setting the C Language Dialect to GNU99, on the other hand, will give you the the for loop declaration ability, along with support for typeof, thereby neatly solving the problem.
Good luck!
2 responses so far ↓
1 dana // Mar 9, 2008 at 2:12 pm
Thanks for posting this. I am new to Cocoa programming but as a Java developer I love unit testing and I could not figure this out.
2 dana // Mar 9, 2008 at 2:38 pm
Hey, I decided to blog about the problem I was having, which was more than just this but since your article helped me out, I linked to it. Check out http://www.dhptech.com/node/27
Leave a Comment