Thread: storage size i and o is unknown error

  1. #1
    Registered User zolfaghar's Avatar
    Join Date
    Mar 2016
    Posts
    95

    storage size i and o is unknown error

    I am trying to write a program for a problem, which asks for moving the curser to different locations of the screen. I just want to get verification that I am running into the same issue of using an outdated text. The chapter instructions are to use the following code, and the details of how it works would be covered later on.

    Code:
    #include "dos.h"
    cls()
    {
         union REGS i, o;
         i.h.ah = 6;
         i.h.al = 0;
         i.h.ch = 0;
         i.h.cl = 0;
         i.h.dh = 24;
         i.h.dl = 79;
         i.h.bh = 7;
         int86 ( 16, &i, &o);
    }
    gotorc ( int r, int c)
    {
         union REGS i, o;
         i.h.ah = 2;
         i.h.bh = 0;
         i.h.dh = r;
         i.h.dl = c;
         int86 ( 16, &i, &o );
    }
    But when I use the above code in the following program, and I try to compile, I see the errors posted right after the code.

    Code:
    #include <stdio.h>
    #include "goto.c"
    int main()
    {
    gotorc ( 10, 30);
    printf ("Just testing to see if I can use the goto.c file");
    }
    Code:
    $ gcc test2.c -o test2
    In file included from test2.c:2:0:
    goto.c: In function 'cls':
    goto.c:4:17: error: storage size of 'i' isn't known
          union REGS i, o;
                     ^
    goto.c:4:20: error: storage size of 'o' isn't known
          union REGS i, o;
                        ^
    goto.c: In function 'gotorc':
    goto.c:18:17: error: storage size of 'i' isn't known
          union REGS i, o;
                     ^
    goto.c:18:20: error: storage size of 'o' isn't known
          union REGS i, o;
                        ^
    Last edited by zolfaghar; 06-04-2016 at 04:22 PM.

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Edit: Actually you might want to compile against DJGPP and see if that compiler works better. GCC and open source compiler ports for windows usually do not handle old MS-DOS headers very well, like conio or dos or graphics.h

    DJGPP C Library Reference
    DJGPP
    Last edited by whiteflags; 06-04-2016 at 04:40 PM.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    You also shouldn't be including a source file.

    I doubt very much if gcc supports those unions. This looks suspiciously like Turbo-C code from ages gone by. Trying to access hardware with today's operating systems is probably not going to be practical, and it's definitely not advised.


    Jim

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > The chapter instructions are to use the following code,
    You have an obsolete book, written on the assumption that you're using an obsolete compiler for an obsolete OS.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User zolfaghar's Avatar
    Join Date
    Mar 2016
    Posts
    95
    Quote Originally Posted by whiteflags View Post
    Edit: Actually you might want to compile against DJGPP and see if that compiler works better. GCC and open source compiler ports for windows usually do not handle old MS-DOS headers very well, like conio or dos or graphics.h

    DJGPP C Library Reference
    DJGPP
    I am definitely going to do a search online to find out more about it. But if you feel charitable:-), would you point me to the right direction as far as the package I need to get up and running on using djgpp quickly? Given that I am using MinGw right now, would you give me a high level instructions on what I need to install in order to use djgpp?

    I also wonder if MinGw and now djgpp are effective tools for developing on and for Windows. Should I consider switching to Visual Studio or something? I feel the command line environment has helped me so much with getting a better understanding of the coding ins and outs. I really appreciate all your comments.

  6. #6
    Registered User zolfaghar's Avatar
    Join Date
    Mar 2016
    Posts
    95
    Quote Originally Posted by jimblumberg View Post
    You also shouldn't be including a source file.

    I doubt very much if gcc supports those unions. This looks suspiciously like Turbo-C code from ages gone by. Trying to access hardware with today's operating systems is probably not going to be practical, and it's definitely not advised.


    Jim
    Allright I'll abandon the book.

  7. #7
    Registered User zolfaghar's Avatar
    Join Date
    Mar 2016
    Posts
    95
    Quote Originally Posted by jimblumberg View Post
    You also shouldn't be including a source file.

    I doubt very much if gcc supports those unions. This looks suspiciously like Turbo-C code from ages gone by. Trying to access hardware with today's operating systems is probably not going to be practical, and it's definitely not advised.


    Jim
    Could you please elaborate on why trying to do this now would not work for my own edification? Or point me to some topics I could read about to get your point? I mean, what was different with Turbo C, which allowed this type of implementation and why did it change?

  8. #8
    Registered User zolfaghar's Avatar
    Join Date
    Mar 2016
    Posts
    95
    Quote Originally Posted by Salem View Post
    > The chapter instructions are to use the following code,
    You have an obsolete book, written on the assumption that you're using an obsolete compiler for an obsolete OS.
    Ok fair enough.
    Thanks

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you want to learn all about DOS, use TurboC etc, then you need DOSBox, an x86 emulator with DOS
    This emulates an 8086 with an awesome 1M of memory (the maximum an 8086 could address).

    But if you want to join the modern world (and have an actual marketable skill when you're done), then start using one of the more recent visual studios and learn some things about the Win32 API (if you want to be a microsoftie)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error-size of te type is unknown
    By as_rule in forum C Programming
    Replies: 5
    Last Post: 08-29-2010, 08:28 AM
  2. storage size of 'sin' isn't known
    By mariab in forum Networking/Device Communication
    Replies: 3
    Last Post: 11-10-2008, 09:01 AM
  3. compile error: storage size of 'var' isn't known
    By George2 in forum C Programming
    Replies: 9
    Last Post: 04-03-2007, 05:45 AM
  4. storage size of regs is unkown
    By Vertex34 in forum C Programming
    Replies: 5
    Last Post: 11-04-2003, 10:17 AM
  5. Replies: 0
    Last Post: 04-29-2003, 09:23 PM

Tags for this Thread