Solved

Cannot compile a program involving initgraph and installuserdriver

Posted on 1997-06-09
1
510 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now