Solved

Cannot compile a program involving initgraph and installuserdriver

Posted on 1997-06-09
1
528 Views
Last Modified: 2008-03-06
hi,
I am writing a rather simple program that involves some graphics, I have created a project in Borland C++ 3.0 for DOS and tha files I have are as follows:

Files included in the project:

svga.cpp -

#include "svga.h"
#include <graphics.h>
#include <stdlib.h>

graph::graph(void){
      int driver, mode, graphDriver, graphMode, GrErr;
      driver = installuserdriver("SVGA256.bgi",NULL);
      if (driver == grError){
      exit(1);
      };//if
      graphMode = 2;
      initgraph(&driver,&graphMode,"");
};//graph constructor




graph.cpp -

#include "svga.h"
#include <graphics.h>
#include <stdlib.h>

graph Graph;
void main(){
};


Other files:

svga.h -

struct colorType{
      unsigned char red, green, blue;
};

class graph {
private:
public:
      graph(void);
//      void fadeScreen(int speed);
//      colorType getPalette(unsigned char colorNumber);
//      void setPalette(unsigned char colorNumber, colorType aColor);
//      void getPicBmp(int xs, int ys, char *fndd);
//      void putPicBmp(char *ff);
};


and the driver - svga256.bgi



when I try to compile this I get two linker errors saying that _installuserdriver and _initgraph in module 'svga.cpp' are undefined symbols.

What am I doing wrong?
0
Comment
Question by:Begemot
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1163874
installuserdriver and initgraph functions do not reside in the default libraries the linker links. Check with the user's guide to find out which library they reside in (I remember it is called something like graph.lib or graphics.lib) and specify that lib file on the complier/linker command line.

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question