Thread: dos graphics

  1. #1
    Unregistered
    Guest

    Red face dos graphics

    This program gives me nine linker errors can someone please help me sort them out:

    undefined symbol _setcolor
    undefined symbol _getmaxcolor
    undefined symbol _grapherrormsg
    undefined symbol _graphresult
    undefined symbol _initgraph...


    #include <stdlib.h>
    #include <stdio.h>
    #include <conio.h>


    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
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    from my bgi days I think those functions are in <graphics.h> so you will need to include that too.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Graphics for DOS under Dev-C++
    By bubux in forum C Programming
    Replies: 16
    Last Post: 07-08-2002, 01:24 PM
  2. Dos graphics header
    By Vicious in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-14-2002, 12:24 PM
  3. Extremely Simple Graphics In Dos
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-07-2002, 07:25 PM
  4. Graphics in DOS help :)
    By PsThrough in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 01-19-2002, 04:02 PM
  5. VC++ graphics in dos.
    By StormySpike in forum C++ Programming
    Replies: 5
    Last Post: 09-28-2001, 10:24 AM