TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: KURT KUZBA
from: NICK GRENFELL
date: 1998-01-29 15:59:00
subject: beginners question

 > NG>   'BGI not initialized, use initgraph'.
 > NG>   I'm guessing it's because the graphics library is not
 > NG>   linked with my program OBJ file.
 >    Right. The default configuration for the .BGI files is
 > as a dynamic linking library. This means that you must use
 > the initgraph to inform the program what library is to be
 > linked, what mode within that library is to be used, and
 > where in the directory structure the .BGI file is to be
 > found, or its path, to be less verbose.
 >    You may find a file called BGIOBJ.EXE in your BGI
 > directory.  If it comes with your compiler, then it will
 > allow you to convert any .BGI file to a static link .OBJ
 > file, which may then be compiled into a library file,
 > using LIB.EXE, also included, or included as part of a
 > project. You will then not be required to distribute the
 > .BGI file as part of your program, since the graphics code
 > will be statically linked and reside within your program
 > itself.
OK, thanks.  I guess a better question would have been, how do I do this?
Here is my program:
----------------------------------------------------------------
/*  triangle.c  */
#include 
#include 
#include 
#define ROWS 3
#define COLUMNS 2
main()
{
    int driver = DETECT;                        /* auto detect driver */
    int mode;                                   /* use best mode */
    int maxx, maxy;                         /* size of screen in pixels */
    int pts [ROWS] [COLUMNS];
    int pixelcolor;
    int startX, startY;
    int newX, newY;
    int rnd;
    long count;
    int numcycles;
    initgraph(&driver, &mode, "d:\\tc\\bgi");
    maxx = getmaxx();                           /* get screen dimensions */
    maxy = getmaxy();
    pixelcolor = 7;
    newX = newY = startX = startY = rnd = count = 0;
    randomize();
    pts[0][0] = maxx/2;                 /* top X */
    pts[0][1] = 0;                      /* top Y */
    pts[1][0] = 0;                      /* left X */
    pts[1][1] = maxy;                           /* left Y */
    pts[2][0] = maxx;                           /* right X */
    pts[2][1] = maxy;                           /* right Y */
    putpixel(pts[0][0], pts[0][1], pixelcolor);
    putpixel(pts[1][0], pts[1][1], pixelcolor);
    putpixel(pts[2][0], pts[2][1], pixelcolor);
    newX = maxx/2;
    newY = maxy/2;
    rnd = random(3);
    startX = pts[rnd][0];
    startY = pts[rnd][1];
    newX = (newX + startX)/2;
    newY = (newY + startY)/2;
    putpixel(newX, newY, pixelcolor);
    while(!kbhit())
    {
        rnd = (rand() % 3);
        startX = pts[rnd][0];
        startY = pts[rnd][1];
        newX = (newX + startX)/2;
        newY = (newY + startY)/2;
        count++;
        pixelcolor = count & 7;
        putpixel(newX, newY, pixelcolor);
    }
    closegraph();                               /* shut down graphics system 
*/
}
----------------------------------------------------------------
The book I have been getting some of my information from gave me 2 options.  
First,
link in graphics.lib with each of the .lib files cs.lib, cl.lib .. etc.  
Using "tlib cs +grahpics.lib"
That didn't seem to work.
Second, create a PROJECT file.  The file would look like:
myprog
graphics.lib
When you make the project, it should include the graphics.lib to make the 
program a stand alone.
This didn't work either that I could tell.
                                                        Thanks...
                                                            Nick
--- FMail/386 1.02
---------------
* Origin: T h e B i o H a z a r d - Phoenix, AZ (1:114/440)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.