We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi! I'm a newbie with using Keil C-51 Compiler! I want to compile a sourcecode and always recive Error 107 unbalanced #if-endif controls! I've looked to all statements and i can not find any mistakes! There is another one! Error 106 unclosed comment! In the compiler discribtion is written: it occurs if there is a '*/' missing, but i don't use comments like this /*--*/ only // comments! because if i am using this /*--*/ type the there is apearring another Error: like this error 141 in line ... near '/' please could anybody help me or give me an advise which is probably wrong! Thanks DANIEL
I am using Keil C51 Compiler Version 3!!!! With the newer Demo Versions there are not any problems!! But why??? I had to use this one, because there is a lot of source code which the Demo Versions do not support!
Error 107 unbalanced #if-endif controls! I've looked to all statements and i can not find any mistakes! That one is one of those that has cost me the most pulled out hair. Usually, after I have given up, I find that it is in - or an interaction with - an included file. My debugging method, after I have decided "I can not find it", for this is to comment out first the includes, then if to endif sections till I get it. This, of course will give umpteen compile errors, but during this process the only one to look for is "unbalanced". When I comment out sections for debugging, I always use something like //qwerty--, that allow a global 'replace with nothing' when the bug is found. good hunmting Erik
Have you also checked all include files, and any nested includes? See Andy's Handy Hint for Debugging Preprocessor Problems:" http://www.8052.com/forum/read.phtml?id=29152
"there is a lot of source code which the Demo Versions do not support!" Like what?
"please could anybody help me or give me an advise which is probably wrong!" Here is an execllent piece of advice which is definitely wrong: Visitors to London should be sure to try out the famous echo in the Reading Room of the British Library
"Usually, after I have given up, I find that it is in - or an interaction with - an included file." That's where you need the preprocessor listing!
are you sure you version of the compiler supports // ? They did not always support it.
Well! I am sure that the compiler supports '//' I've changed a couple of things for example i deleted all '*' in the comments and used '//' for '/*-*/' in all files! Moreover i set all #if to #ifdef Now there is no longer the error message #if-endif and unclosed comment! But instead of being free of errors i get about 50 more syntax errors!!! It is really frustrating! Ok! I had to life with the error messages, but i don't understand that the original source is compileable at the newest version, without any problems! Have they changed so many thing? Best regards DANIEL
I am using Keil C51 Compiler Version 3!!!! Have they changed so many thing? Well, we're currently shipping C51 version 7. Version 3 was released sometime around 1991. So, yes, in 13 years I'm sure some things were changed. Jon
Have you looked at the preprocessor listing yet?
When having mismatched #if..#endif problems myself some time ago, I wrote a little PC utility to check them - I'll see if I can find it again... Meanwhile, have you tried GREP?
Well, now have i solved the most errors! It seems to be that the compiler don't like #defines which are calling a other #define for example: #XXX 10 #YYY 1000/XXX I think it causes the most problems. Now there only 4 errors left! I think i could solve them by myself, too. Thanks to all which have replaied! I'll be back!!! :) I am sure with new problems! Best regards DANIEL