January 16, 2006
error C2143: syntax error : missing ';' before 'type'
When programming in Visual Studio, if you happen to run across this error while trying to compile C code, one thing to check on is whether or not you're declaring your local variables inline. For whatever reason, Visual Studio hates this and issues a syntax error for the next line of code. One that's of no use whatsoever in helping to figure out what to do.
So, for example, if you have a function like:
int foo(int x) { assert(x != 0); int y = 4/x; return y; }You would need to rewrite your code like this:
int foo(int x) { int y; assert(x != 0); y = x/4; return y; }Strange but true. I suspect there's an option somewhere to turn off the strictness of the compiler, but I haven't found it.
Wednesday, October 08, 2008
RARW! C language
C, Handle-C, C++... killing me with all the stupid bugs...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment