Hi All,
    I'm a newbie for sdcc.
    A few days ago, I was in use of SDCC, ran into a problem.

    Program (bee.c) is very simple, as follows:
    #include<reg51.h>
    #include<stdio.h>
    sbit P10=P1^0;
    sbit P17=P1^7;
     int main(void)
     {
        unsigned char j;
        unsigned int i;
        while(1){
                    P17=1;
                    while(P17==0)
                       {
                        for(i=1;i<=500;i++)
                         {
                               P10=~P10;
                               for(j=0;j<=50;j++);
                         }

                         for(i=1;i<=250;i++)
                               {
                               P10=~P10;
                               for(j=0;j<=100;j++);
                               }
                        }
                    }
         return 0;
      }
      My compiler option was sdcc -mmcs51 bee.c
      But SDCC gave me such an error message :  bee.c:3:error 2:Initializer
element is not constant

 bee.c:4:error 2:Initializer element is not constant
      It means the expression: sbit P10=P1^0 was wrong.
      I used keil C running the program,it compiled successfully,no
errors,no warnings.
      Later,I got other programs to compile with SDCC.I found that where
there is sbit instructions, there is error 2:Initializer element is not
constant
      But keil C still can compile successfully.
      So,what is the solutions?To modify the program?How to do it? Or modify
the sdcc?

      thanks!
 Donald
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to