declaration syntax error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ucu13
    New Member
    • May 2012
    • 14

    declaration syntax error

    i have this code:

    //implementarea clasei Proces
    #ifndef RTProces.CPP
    #define RTProces.CPP

    #include<dos.h>
    #include"RTproc es.h"

    extern int p[21][4];
    //Constructorul clasei Proces
    RTproces::RTpro ces(info_init_p roces info_init)
    {
    p_env->j_ip=FP_OFF(in fo_init.adr_ini tiala);
    p_env->j_cs=FP_SEG(in fo_init.adr_ini tiala);
    p_env->j_flag=0x200 ;
    p_env->j_ds=_DS;
    p_env->j_es=_ES;
    p_env->j_bp=_BP;
    p_env->j_si=_SI;
    p_env->j_di=_DI;
    strcpy(p_nume,i nfo_init.numePr oces);
    p_dim_stiva=inf o_init.dimStiva ;
    p_stare=info_in it.stare;
    p_adr_proces=in fo_init.adr_ini tiala;
    }

    #endif

    the program display me this error "declaratio n syntax error"
    and i don't now from what cause.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    this two line
    Code:
    #ifndef RTProces.CPP
    #define RTProces.CPP

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      It's here: RTProces.CPP

      Your tokens must be alphanumeric. Take out the dot.

      Does this code mean that you are using #include on .cpp files?

      Comment

      • ucu13
        New Member
        • May 2012
        • 14

        #4
        johny10151981:t his two lines..but what is the problem with this to lines.i used this two lines in more than this project file and i don't have any error,only in this case i have a error.
        weaknessforcats :do you refer on include RTProces.cpp or define

        Comment

        • ucu13
          New Member
          • May 2012
          • 14

          #5
          now if i use the declaration like this i have the same error
          Code:
          //implementarea clasei Proces
          #ifndef __RTProces_CPP
          #define __RTProces_CPP
          
          #include<dos.h>
          #include"RTproces.h"
          
          extern int p[21][4];
          //Constructorul clasei Proces
          RTproces::RTproces(info_init_proces info_init)
          {
          	p_env->j_ip=FP_OFF(info_init.adr_initiala);
          	p_env->j_cs=FP_SEG(info_init.adr_initiala);
          	p_env->j_flag=0x200;
          	p_env->j_ds=_DS;
          	p_env->j_es=_ES;
          	p_env->j_bp=_BP;
          	p_env->j_si=_SI;
          	p_env->j_di=_DI;
          	strcpy(p_nume,info_init.numeProces);
          	p_dim_stiva=info_init.dimStiva;
          	p_stare=info_init.stare;
          	p_adr_proces=info_init.adr_initiala;
          }
          
          #endif
          or

          Code:
          //implementarea clasei Proces
          #ifndef __RTProces_CPP
          #define __RTProces_CPP
          
          #include<dos.h>
          #include"RTproces.h"
          
          extern int p[21][4];
          //Constructorul clasei Proces
          RTproces::RTproces(info_init_proces info_init)
          {
          	p_env->j_ip=FP_OFF(info_init.adr_initiala);
          	p_env->j_cs=FP_SEG(info_init.adr_initiala);
          	p_env->j_flag=0x200;
          	p_env->j_ds=_DS;
          	p_env->j_es=_ES;
          	p_env->j_bp=_BP;
          	p_env->j_si=_SI;
          	p_env->j_di=_DI;
          	strcpy(p_nume,info_init.numeProces);
          	p_dim_stiva=info_init.dimStiva;
          	p_stare=info_init.stare;
          	p_adr_proces=info_init.adr_initiala;
          }
          
          #endif
          in all my project i have 6 error all like this and i can't figure out what is the reason!!!

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Fix the first error only. Other errors may be caused by the first one.

            What is te first error exactly?

            Remember, the error location is where the compiler found itself in trouble. The actual error may be from there to anyplace earlier in the file that was being compiled.

            Comment

            • ucu13
              New Member
              • May 2012
              • 14

              #7
              the first error is delaration syntax error on this line:
              Code:
              RTproces::RTproces(info_init_proces info_init)
              but at the first part of the code if i let the original code like this
              Code:
              #ifndef __RTProces_CPP
              #define __RTProces_CPP
              i have more than one error but
              if i modify this line with this
              Code:
              #ifndef RTProces.CPP
              #define RTProces.CPP
              i have only the error that I mentioned at first

              Comment

              • weaknessforcats
                Recognized Expert Expert
                • Mar 2007
                • 9214

                #8
                So has the compiler seen the class declation for RTproces yet?

                I still ave the feeling you are doing #includes on .cpp files, which is a big no-no. I get that feeling becuase .cpp files usually don't have #ifndef syntax in them.

                The corrrect thing is to compile each .cpp separately and let the linker resolve any addesses.

                Comment

                Working...