I was trying to compile a very basic test program that was less than 170 lines of code. I kept getting "Expected unqualified id before "if"" errors. I went through my code multiple times and retyped a good portion of it, but to no avail. I took out my comments from the problem function...and it compiled and worked fine! I wrote a comment back in, and it game me errors! The comments were on their own lines, separate from code lines. Also, during my testing, I commented out a simple line of code (x+=5;), but it still tried to compile it. It gave an error on a line that was all comment, no code. I have never seen this before. Anyone else run into this or have any ideas as to why this happened?
My IDE automatically saves the files before compilation. I'm not sure if this will reproduce the
message, but my code looked something like this:
1 2 3 4 5
if (dir==1){
x+=4;
y+=4;}
//lots of these with the occasional "//****************************\\" to help with readability
//when I took out the dividing comments, it compiled fine