gcc (rh 9.0 ) I do not know how to correct the error...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mylinux

    gcc (rh 9.0 ) I do not know how to correct the error...

    program was taken from http://www.beyondlogic.org/parlcd/parlcd.htm

    when compile under rh 9.0


    I do not know how to correct this error.


    can u help? there is dos.h in my linux box.


    thanks.

    [root@home BLCD]# gcc test5.c test5
    gcc: test5: No such file or directory
    test5.c:1: parse error before numeric constant
    test5.c:9:17: dos.h: No such file or directory
    In file included from test5.c:10:
    /usr/include/string.h:39: parse error before "size_t"
    /usr/include/string.h:42: parse error before "size_t"
    /usr/include/string.h:51: parse error before "size_t"
    /usr/include/string.h:58: parse error before "size_t"
    /usr/include/string.h:61: parse error before "size_t"
    /usr/include/string.h:65: parse error before "size_t"
    /usr/include/string.h:86: parse error before "size_t"
    /usr/include/string.h:93: parse error before "size_t"
    /usr/include/string.h:99: parse error before "size_t"
    /usr/include/string.h:106: parse error before "strxfrm"
    /usr/include/string.h:107: parse error before "size_t"
    /usr/include/string.h:176: parse error before "strcspn"
    /usr/include/string.h:180: parse error before "strspn"
    /usr/include/string.h:230: parse error before "strlen"
    /usr/include/string.h:248: parse error before "size_t"
    /usr/include/string.h:253: parse error before "size_t"
    /usr/include/string.h:257: parse error before "size_t"
    /usr/include/string.h:260: parse error before "size_t"
    /usr/include/string.h:263: parse error before "size_t"
    /usr/include/string.h:291: parse error before "size_t"
    test5.c: In function `main':
    test5.c:21: warning: return type of `main' is not `int'
    [root@home BLCD]#



  • Phlip

    #2
    Re: gcc (rh 9.0 ) I do not know how to correct the error...

    Mylinux wrote:
    [color=blue]
    > [root@home BLCD]# gcc test5.c test5
    > gcc: test5: No such file or directory
    > test5.c:1: parse error before numeric constant[/color]

    Unfortunately, you are not asking how C++ (the topic of one of your
    newsgroups) works.

    You are asking how gcc works - how to compile a C program with it, how to
    direct it to included files, etc.

    You must ask this question on a single newsgroup or mailing list that covers
    gcc, for the best results.

    (You also should attend to any Makefile or "configure" files that may have
    come with this source.)

    Use http://www.google.com and http://groups.google.com to find the best
    forum for this question.

    --
    Phlip


    Comment

    • Mylinux

      #3
      the latest current error when compile .... (rh 9.0 ) I do not know how to correct the error...

      [root@home BLCD]# gcc test5.c test5
      gcc: test5: No such file or directory
      test5.c:9:17: dos.h: No such file or directory
      test5.c: In function `main':
      test5.c:21: warning: return type of `main' is not `int'
      [root@home BLCD]#


      /* LCD Module Software */
      /* 17th May 1997 */
      /* Copyright 1997 Craig Peacock */
      /* WWW - http://www.senet.com.au/~cpeacock */
      /* Email - cpeacock@senet. com.au */
      /* */
      /* Register Select must be connected to Select Printer (PIN 17) */
      /* Enable must be connected to Strobe (PIN1) */
      /* DATA 0:7 Connected to DATA 0:7 */

      #include <dos.h>
      #include <string.h>

      #define PORTADDRESS 0x378 /* Enter Your Port Address Here */

      #define DATA PORTADDRESS+0
      #define STATUS PORTADDRESS+1
      #define CONTROL PORTADDRESS+2

      void main(void)
      {
      char string[] = {"Testing 1,2,3 "
      "It' Works ! "};
      char init[10];
      int count;
      int len;
      init[0] = 0x0F; /* Init Display */
      init[1] = 0x01; /* Clear Display */
      init[2] = 0x38; /* Dual Line / 8 Bits */

      outportb(CONTRO L, inportb(CONTROL ) & 0xDF); /* Reset Control Port - Make
      sure Forward Direction */

      outportb(CONTRO L, inportb(CONTROL ) | 0x08); /* Set Select Printer (Register
      Select) */

      for (count = 0; count <= 2; count++)
      {
      outportb(DATA, init[count]);
      outportb(CONTRO L,inportb(CONTR OL) | 0x01); /* Set Strobe (Enable)*/
      delay(20); /* Larger Delay for INIT */
      outportb(CONTRO L,inportb(CONTR OL) & 0xFE); /* Reset Strobe (Enable)*/
      delay(20); /* Larger Delay for INIT */
      }

      outportb(CONTRO L, inportb(CONTROL ) & 0xF7); /* Reset Select Printer
      (Register Select) */

      len = strlen(string);

      for (count = 0; count < len; count++)
      {
      outportb(DATA, string[count]);
      outportb(CONTRO L,inportb(CONTR OL) | 0x01); /* Set Strobe */
      delay(2);
      outportb(CONTRO L,inportb(CONTR OL) & 0xFE); /* Reset Strobe */
      delay(2);
      }
      }




      Comment

      • Mylinux

        #4
        Re: gcc (rh 9.0 ) I do not know how to correct the error...

        I have ohter Makefile.


        basically there is gcc test5.c test


        since there is only one single test5.c. I think I should to ask expert to
        help me out.


        Comment

        • SenderX

          #5
          Re: the latest current error when compile .... (rh 9.0 ) I do not know how to correct the error...

          > void main(void)

          :/


          Comment

          • Mylinux

            #6
            Re: the latest current error when compile .... (rh 9.0 ) I do not know how to correct the error...


            SenderX <xxx@xxx.xxx> wrote in message
            news:6f4gb.5046 84$cF.180114@rw crnsc53...[color=blue][color=green]
            > > void main(void)[/color]
            >
            > :/
            >[/color]


            [lcd@home BLCD]$ gcc -g -c test5.c -o test5
            test5.c:9:17: dos.h: No such file or directory
            test5.c: In function `main':
            test5.c:20: warning: return type of `main' is not `int'
            [lcd@home BLCD]$

            I have tried that too.
            but the error is like the above.


            [color=blue]
            >[/color]


            Comment

            • Jay

              #7
              Re: gcc (rh 9.0 ) I do not know how to correct the error...

              Mylinux wrote:
              [color=blue]
              > program was taken from http://www.beyondlogic.org/parlcd/parlcd.htm
              >
              > when compile under rh 9.0
              >
              >
              > I do not know how to correct this error.
              >
              >
              > can u help? there is dos.h in my linux box.
              >
              >
              > thanks.
              >
              > [root@home BLCD]# gcc test5.c test5
              > gcc: test5: No such file or directory[/color]

              Stupidity will never get you very far.
              Don't you even read the error messages?

              Or is there something inherently difficult about
              interpreting what "No such file or directory" means?

              Comment

              • Kevin Goodsell

                #8
                Re: gcc (rh 9.0 ) I do not know how to correct the error...

                Mylinux wrote:
                <snip>

                This is not topical in comp.lang.c++. Please remove it from the
                cross-post list when replying. Thank you.

                -Kevin
                --
                My email address is valid, but changes periodically.
                To contact me please use the address from a recent posting.

                Comment

                • Shane Beasley

                  #9
                  Re: the latest current error when compile .... (rh 9.0 ) I do not know how to correct the error...

                  "Mylinux" <myLinux@My.com > wrote in message news:<blqiid$2u i5@imsp212.netv igator.com>...
                  [color=blue]
                  > [root@home BLCD]# gcc test5.c test5[/color]

                  FWIW, this is a C++ newsgroup, not a C newsgroup. Of course your
                  problem has nothing to do with either C or C++...
                  [color=blue]
                  > gcc: test5: No such file or directory
                  > test5.c:9:17: dos.h: No such file or directory[/color]

                  ISO C++ does not have a <dos.h> header, nor do most systems which are
                  not DOS (e.g., Red Hat).

                  The function outportb() is not part of C++. Rather, it's part of some
                  system-specific API. I'm guessing that this code was written to be
                  built under DOS, but you're now trying to build it under Red Hat. C++
                  cannot do what you need; you need to use Linux-specific functionality.
                  Consult a Linux newsgroup for more info on that.
                  [color=blue]
                  > test5.c: In function `main':
                  > test5.c:21: warning: return type of `main' is not `int'[/color]

                  main() must have int as its return type, not void. (And in C, it must
                  also return a value, e.g., 0).

                  - Shane

                  Comment

                  Working...