views:

56

answers:

1

Hey there!

I guess many of you know this problem, when programming C++ with visual studio, there are cases which a simple syntax error can cause many hundreds of compiler errors. For example if you forget the ; in the end of a class definition, Visual studio will output many syntax errors in files which are actually completely fine.

Is there a way to quickly find the source of such a problem?

Thanks!

+3  A: 

Generally you should just look at the first one or two errors. In situations you describe, everything after that pretty much just means the compiler is mighty confused.

Alex Deem
hey and thanks for the answer!the problem is, that visual studio doesn't seem to display the actual problem first. it outputs hundreds of silly syntax errors at places which are completely fine
Mat
If you are looking at the task view it generally shows things in the opposite order. I personally use the output tab which shows things from top to bottom.
the output tab also lists silly syntax errors first (like 'missing ';' before...) at arbitrary positions in the code.Some of the errors also are 'unexpected end of file' (also at arbitrary positions) so my guess is that somewhere in a header file is a } too less or too much or a ; is REALLY missing somewhere. But how to find it?? what's the best way to track down that error?
Mat
I don't know if it is the best way but I usually start with the file that the first error in output view, as long as warnings aren't set as errors, and start commenting out includes in that file and compiling after each one to see if the errors change from "missing ; before" to the stuff in that header is missing.