Thread: line graphics almost there(I think)

  1. #1
    Unregistered
    Guest

    Smile line graphics almost there(I think)

    One error as stated on the second line how do I solve this
    thx for your help ant


    #include <conio.h>
    #include <graphics.lib> /* error message here unable to open graphics.lib */

    int main(void)
    {
    /* request auto detection */
    int gdriver = DETECT, gmode, errorcode;
    int xmax, ymax;

    /* initialize graphics and local variables */
    initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

    /* read result of initialization */
    errorcode = graphresult();
    /* an error occurred */
    if (errorcode != grOk)
    {
    printf("Graphics error: %s\n", grapherrormsg(errorcode));
    printf("Press any key to halt:");
    getch();
    exit(1);
    }

    setcolor(getmaxcolor());
    xmax = getmaxx();
    ymax = getmaxy();

    /* draw a diagonal line */
    line(0, 0, xmax, ymax);

    /* clean up */
    getch();
    closegraph();
    return 0;
    }

  2. #2
    Registered User *pointer's Avatar
    Join Date
    Oct 2001
    Posts
    74
    Make sure that .lib file exists before trying to use it. Is it one that you created? Because I don't have it in my standard libraries, that could be your problem.
    pointer = NULL

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    you don't #include lib files...

    try

    #pragma comment(lib,"graphics.lib") //no ;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 04:13 PM
  2. adding line numbers and concatenating a filename
    By durrty in forum C Programming
    Replies: 25
    Last Post: 06-28-2008, 03:36 AM
  3. Finding carriage returns (\c) in a line
    By JizJizJiz in forum C++ Programming
    Replies: 37
    Last Post: 07-19-2006, 05:44 PM
  4. Adding Line numbers in Word
    By Mister C in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 06-24-2004, 08:45 PM
  5. Graphics Devices and Cprintf clash
    By etnies in forum C Programming
    Replies: 6
    Last Post: 05-09-2002, 11:14 AM