Solved

Cannot compile a program involving initgraph and installuserdriver

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  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 …
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

863 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

28 Experts available now in Live!

Get 1:1 Help Now