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

Help!!

I am using c8051F226 and Cx51 compiler..I received this error and warning...

*** WARNING C206 IN LINE 9 OF LCD2.C: 'lcdcmd': missing function-prototype

*** ERROR C267 IN LINE 9 OF LCD2.C: 'lcdcmd': requires ANSI-style prototype

void main()
{
  lcdcmd(0x38);      //THIS IS MY LINE 9
  lcdcmd(0x0E);
  lcdcmd(0x01);
  lcdcmd(0x06);
  lcdcmd(0x80);
  lcddata('A');
  lcddata('B');
  lcddata('C');

}

I have read the error description... Can anybody tell me what's wrong with this and what should i do in order not to get this error??

Thanks

Parents
  • "you need to add a function ... if you do it before main, you do not need a prototype"

    Correct.

    Probably time for the OP to have a re-read of his/her 'C' textbook:
    Like many other programming languages, 'C' requires that everything must be declared before it can be used.

    "if you add it afterwards, then you do [need a prototype]"

    Also if the definition is in a separate file.

    There is one case where you can get away without providing an explicit declaration - it is left as an excercise to the student to consider when this might be...

Reply
  • "you need to add a function ... if you do it before main, you do not need a prototype"

    Correct.

    Probably time for the OP to have a re-read of his/her 'C' textbook:
    Like many other programming languages, 'C' requires that everything must be declared before it can be used.

    "if you add it afterwards, then you do [need a prototype]"

    Also if the definition is in a separate file.

    There is one case where you can get away without providing an explicit declaration - it is left as an excercise to the student to consider when this might be...

Children