This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

c141 error in uV 4.0

hello,
i am using keil uvision 4.0 for my 8051 projects.i am getting an error whenever i use the pre defined word 'else' in my code.
ex:

if(an1==1)

{

LED1=1;

LED2=1;

else //at this point//

LED1=0;

LED2=0;
}

it shows an error C141. Can you please help me out..

Parents
  • I see no one did teach you to fish - it isn't "teach a man a fish".

    But more importantly: do you think it is a bad idea to tell someone that they should spend some time with a book about the C language? In what way is that bad? You prefer that people learn without books - asking about every single aspect of the language on a forum? But how can someone ask about a concept they don't even know exists?

Reply
  • I see no one did teach you to fish - it isn't "teach a man a fish".

    But more importantly: do you think it is a bad idea to tell someone that they should spend some time with a book about the C language? In what way is that bad? You prefer that people learn without books - asking about every single aspect of the language on a forum? But how can someone ask about a concept they don't even know exists?

Children
  • Man, do you suffer from tunnel vision?

    What I'm saying is that I once got caught on the very same problem. I had some books, but nothing seemed to make sense. Then someone told me the same like explained here. It was the nudge I needed so my learning could commence and continue and progress.

    If some dumb-ass fool had just said 'read the manual', I might have just given up. But I was lucky. Someone gave me that nudge and I am eternally grateful to them. Without that, I would possibly have ended up in a dead end, pretentious job. I could even have shamed my family and become ... a ... consultant (weep).

  • A least I'm sagacious enough to recognize when Please read the manual isn't the appropriate answer.

  • And for what it's worth, I admire your keen mental discernment and good judgment that you show in such matters.

  • "Man, do you suffer from tunnel vision?"

    No, but I constantly suffer from people not realizing the reason for tagging posted source code properly since indentation was an important step in the development of modern programming languages.

    With source code properly indented, and with a look at "block statements" in a C book, it would be obvious that this poor "else" didn't have any family to reunite with.

    The interesting thing is also that we constantly gets posts with "i am getting an error" instead of posts that specifically writes out the error message the compiler emits. For some very strange reason, the error messages quite often adds some clues what might be wrong.

    It is way easier to "nudge" people with specific information when they show they have spent some time looking into issues and trying to eliminate possible error sources.

    Something as simple as googling for "how to use else in C" would have given lots and lots of hints what could have been wrong with the posted source code. But for people who don't like to google individual issues (there are billions of possible ways things can go wrong) it is normally better to get a good C book and work through it since it will cover quite a lot of potential hurdles.

    In the end, people do need to learn how to fish, unless they have the money to always buy the fish. Just that schools doesn't allow the students to buy the solutions from consultants.

  • What a load of bluster.

    I'm just glad the person I asked recognised what I needed when I needed it. Sometimes there is no excuse, a simple question can be best dealt with by giving a simple, straightforward and direct answer. Obviously, you are too 'good' to believe that.