?
Solved

Cannot compile a program involving initgraph and installuserdriver

Posted on 1997-06-09
1
Medium Priority
?
548 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

719 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