DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Re: Why is my compiler doing this????---source code for Danny Kalev

  1. #1
    NANOSAURUS Guest

    Re: Why is my compiler doing this????---source code for Danny Kalev


    Do you know an easier way to get into mode 13 if so could you please post
    it.

    source code:

    int main(int argc, char *argv[])
    {
    #define uchar unsigned char

    void Video::Write_DAC_C_Palette(uchar StartColor,uchar NumOfColors,uchar
    *Palette)
    { outp(0x03C6,0xff); //Mask all registers so we can update any of
    them
    outp(0x03C8,StartColor); //1st color to input!
    for(short i=0; i<NumOfColors*3; i++ )
    {outp(0x03C9,Palette[i]<<2);
    }
    }

    void Video::Set_DAC_C(uchar Color,uchar Red, uchar Green, uchar Blue)
    { outp(0x03C6,0xff); //Mask all registers even though we only need 1
    of them
    outp(0x03C8,Color); //Color to set
    outp(0x03C9,Red);
    outp(0x03C9,Green);
    outp(0x03C9,Blue);
    }
    }

    Here are the errors:28 in all

    c:\my documents\my music\sdfsdfsdf.cpp: In function `int main(int, char **)':
    c:\my documents\my music\sdfsdfsdf.cpp:22: variable or field `Video' declared
    void
    c:\my documents\my music\sdfsdfsdf.cpp:22: parse error before `::'
    c:\my documents\my music\sdfsdfsdf.cpp:24: `StartColor' undeclared (first
    use this function)
    c:\my documents\my music\sdfsdfsdf.cpp:24: (Each undeclared identifier is
    reported only once
    c:\my documents\my music\sdfsdfsdf.cpp:24: for each function it appears in.)
    c:\my documents\my music\sdfsdfsdf.cpp:24: implicit declaration of function
    `int outp(...)'
    c:\my documents\my music\sdfsdfsdf.cpp:25: `NumOfColors' undeclared (first
    use this function)
    c:\my documents\my music\sdfsdfsdf.cpp:26: `Palette' undeclared (first use
    this function)
    c:\my documents\my music\sdfsdfsdf.cpp: At top level:
    c:\my documents\my music\sdfsdfsdf.cpp:30: syntax error before `::'
    c:\my documents\my music\sdfsdfsdf.cpp:32: `Color' was not declared in this
    scope
    c:\my documents\my music\sdfsdfsdf.cpp:32: ANSI C++ forbids declaration `outp'
    with no type
    c:\my documents\my music\sdfsdfsdf.cpp:32: warning: `outp' was previously
    implicitly declared to return `int'
    c:\my documents\my music\sdfsdfsdf.cpp:32: initializer list being treated
    as compound expression
    c:\my documents\my music\sdfsdfsdf.cpp:33: `Red' was not declared in this
    scope
    c:\my documents\my music\sdfsdfsdf.cpp:33: ANSI C++ forbids declaration `outp'
    with no type
    c:\my documents\my music\sdfsdfsdf.cpp:33: redefinition of `int outp'
    c:\my documents\my music\sdfsdfsdf.cpp:32: `int outp' previously defined
    here
    c:\my documents\my music\sdfsdfsdf.cpp:33: initializer list being treated
    as compound expression
    c:\my documents\my music\sdfsdfsdf.cpp:34: `Green' was not declared in this
    scope
    c:\my documents\my music\sdfsdfsdf.cpp:34: ANSI C++ forbids declaration `outp'
    with no type
    c:\my documents\my music\sdfsdfsdf.cpp:34: redefinition of `int outp'
    c:\my documents\my music\sdfsdfsdf.cpp:33: `int outp' previously defined
    here
    c:\my documents\my music\sdfsdfsdf.cpp:34: initializer list being treated
    as compound expression
    c:\my documents\my music\sdfsdfsdf.cpp:35: `Blue' was not declared in this
    scope
    c:\my documents\my music\sdfsdfsdf.cpp:35: ANSI C++ forbids declaration `outp'
    with no type
    c:\my documents\my music\sdfsdfsdf.cpp:35: redefinition of `int outp'
    c:\my documents\my music\sdfsdfsdf.cpp:34: `int outp' previously defined
    here
    c:\my documents\my music\sdfsdfsdf.cpp:35: initializer list being treated
    as compound expression
    c:\my documents\my music\sdfsdfsdf.cpp:36: parse error before `}'




    Danny Kalev <dannykk@inter.net.il> wrote:
    >please post the code and the error message you're getting. Besides, why
    >are you using such low-level and totally non-portable features? You can
    >use the <graphics.h> or <conio.h> functions to change the background
    >color.
    >
    >Danny
    >
    >NANOSAURUS wrote:
    >>
    >> ok whenever i try to compile some code that tries to get the computer

    into
    >> 0x13 VGA mode i get compiler errors. could this be my compiler--Im using
    >> DEV C++ 4.0 and yes i do have all the appropriete header files.



  2. #2
    Danny Kalev Guest

    Re: Why is my compiler doing this????---source code for Danny Kalev



    NANOSAURUS wrote:
    >
    > Do you know an easier way to get into mode 13 if so could you please post
    > it.
    >
    > source code:
    >
    > int main(int argc, char *argv[])
    > {
    > #define uchar unsigned char
    >
    > void Video::Write_DAC_C_Palette(uchar StartColor,uchar NumOfColors,uchar
    > *Palette)
    > { outp(0x03C6,0xff); //Mask all registers so we can update any of
    > them
    > outp(0x03C8,StartColor); //1st color to input!
    > for(short i=0; i<NumOfColors*3; i++ )
    > {outp(0x03C9,Palette[i]<<2);
    > }
    > }
    >
    > void Video::Set_DAC_C(uchar Color,uchar Red, uchar Green, uchar Blue)
    > { outp(0x03C6,0xff); //Mask all registers even though we only need 1
    > of them
    > outp(0x03C8,Color); //Color to set
    > outp(0x03C9,Red);
    > outp(0x03C9,Green);
    > outp(0x03C9,Blue);
    > }
    > }
    >
    > Here are the errors:28 in all
    >
    > c:\my documents\my music\sdfsdfsdf.cpp: In function `int main(int, char **)':
    > c:\my documents\my music\sdfsdfsdf.cpp:22: variable or field `Video' declared
    > void


    Where's the declaration of class Video? There's no declaration thereof
    before main() nor is there an #include file.
    Where is the #include file of the outp() function?

    In short, you need to add all the missing declarations and header files
    to your code. Then, if you still encounter errors, you can post them
    here.

    Danny

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center