Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 560
  • Last Modified:

Cannot compile a program involving initgraph and installuserdriver

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
Begemot
Asked:
Begemot
1 Solution
 
chensuCommented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now