www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/01/03:17:01

Xref: news2.mv.net comp.os.msdos.djgpp:6653
From: landmark AT vcn DOT bc DOT ca (Scott Phung)
Newsgroups: comp.os.msdos.djgpp
Subject: Compile Errors
Date: 31 Jul 1996 21:45:15 -0700
Organization: Vancouver Community Net
Lines: 98
Message-ID: <4tpcor$hbo@opus.vcn.bc.ca>
NNTP-Posting-Host: opus.vcn.bc.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello, i am a newbie to C and DJGPP.

Upon finding and trying to compile this graphics program with DJGPP,
i have come up with the following errors:

Much help would be appreciated if anyone can help me fix it.

Thanks,
Scott.


command-line:
c:\djgpp\gcc.exe c:\djgpp\include\gfx-1.cc -o c:\djgpp\source\gfx-1.exe -lm
----------------------------------------------------------------------------


Error Messages from the compiler:
----------------------------------------------------------------------------

c:\\djgpp\\include\\gfx-1.cc:17: warning: implicit declaration of function
`int MK_FP(...)'
c:\\djgpp\\include\\gfx-1.cc: In function `void SetMCGA()':
c:\\djgpp\\include\\gfx-1.cc:21: `_AX' undeclared (first use this function)
c:\\djgpp\\include\\gfx-1.cc:21: (Each undeclared identifier is reported
only once
c:\\djgpp\\include\\gfx-1.cc:21: for each function it appears in.)
c:\\djgpp\\include\\gfx-1.cc:22: warning: implicit declaration of function
`int geninterrupt(...)'
c:\\djgpp\\include\\gfx-1.cc: In function `void SetText()':
c:\\djgpp\\include\\gfx-1.cc:26: `_AX' undeclared (first use this function)
c:\\djgpp\\include\\gfx-1.cc: In function `void Cls(unsigned char)':
c:\\djgpp\\include\\gfx-1.cc:31: warning: implicit declaration of function
`int memset(...)'
c:\\djgpp\\include\\gfx-1.cc: In function `void TestPutpixel()':
c:\\djgpp\\include\\gfx-1.cc:40: parse error before `)'
c:\\djgpp\\include\\gfx-1.cc:49: parse error before `;'
c:\\djgpp\\include\\gfx-1.cc:53: warning: implicit declaration of function
`int TestPutPixel(...)'


The program, gfx-1.cc, in c:\djgpp\include
----------------------------------------------------------------------------

#include <conio.h>    // getch(), clrscr()
#include <dos.h>      // MK_FP, geninterrupt()
#include <mem.h>      // memset()
#include <stdio.h>    // printf()
#include <stdlib.h>   // rand()


void SetMCGA();
void SetText();
void Cls(unsigned char Col);
void Putpixel (int x, int y, unsigned char Col);
void Putpixel (int x, int y, unsigned char Col);
void TestPutpixel ();


// declare a pointer to the offset of VGA memory
unsigned char *vga = (unsigned char *) MK_FP(0xA000, 0);


void SetMCGA() {
    _AX = 0x0013;
    geninterrupt (0x10);
  }

void SetText() {
    _AX = 0x0003;
    geninterrupt (0x10);
  }

void Cls(unsigned char Col) {
    memset(vga, Col, 0xffff);  //"vga" is a pointer to address 0xa0000
  }

void Putpixel (int x, int y, unsigned char Col) {
    memset(vga+x+(y*320),Col,1);
  }

void TestPutpixel () {
    int loop1, loop2;
    for (loop1 = 0, loop1 < 319, loop1++) {
	for (loop2 = 0, loop2 < 199, loop2++) {
	    putpixel (loop1, loop2, rand());
	}
    }


void main() {
    clrscr();
    SetMCGA();
    Cls(32);
    getch();
    Cls(90);
    TestPutPixel();
    SetText();
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019