Initgraph Error In Dev C++

  
Initgraph Error In Dev C++ Rating: 8,8/10 518 votes


initgraph function is used to initialize with the graphics library and changes to the graphics screen for drawing. It is the first step you need to do during graphics programming. The sample code is given below on this page.

You need to pass the graphics driver and graphics mode to this function. Usually we will use VGA and VGAHI for graphics driver and mode (640 x 480 pixels) respectively. Alternatively you can use detectgraph to find out the driver and mode for you.

It is quite often that you will see the linker error message when you do compile and link program - Linker Error: Undefined symbol _initgraph in module. Click here for more information on this.


Jan 08, 2013  None of these work. The compilation works fine, but when I try to run the file I get something like this Linker error undefined reference to `initgraph' for all grahpic related functions. I suspect it is a linking problem but I cannot figure how to get over it. I have tried writing -L'C:/Dev-Cpp/lib' in the linker command line, but didn't work. In Turbo C/C, the graphics driver files are in the C: TC BGI directory, by default. This is how you use it, and an example program (which just draws a white line on a black graphics screen). Initgraph Initializes the graphics system. Aug 21, 2018 World's Most Famous Hacker Kevin Mitnick & KnowBe4's Stu Sjouwerman Opening Keynote - Duration: 36:30. Cyber Investing Summit Recommended for you. File in initgraph section, usually this BGI file is located under the TCBGI directory. Hope till now it is clear that what we want to computer-like objects in the Emperor's throne room? Is there a name for the (anti- ) pattern of passing parameters are valuable to us.

I have a problem with graphics in c. It is a simple program, that displays circle. The functions in graphics.h are only supported by old ancient Turbo C and Turbo C compilers. Those functions can not be used by any modern 32-bit compiler. You can either get a copy of that old MS-DOS compiler. Dev-Cpp is an application which is used to code and run programs in C/C. It has its variations but none of them come with a pre-installed graphics library. So if you are switching from some primitive editor like TurboC to Dev-Cpp (which follows ANSI specifications correctly) and try to write the following code, it. Graphics.h requires a specific library that is only found on Borland compilers (I don't think the newer Borland products even have it anymore).


Source Code

#include<graphics.h>

#include <stdio.h>

#include<math.h>

#include<conio.h>

#include<dos.h>

#include<stdlib.h>

void main()

{

int i, grd, grm;

int x, y, w, gresult;

detectgraph(&grd,&grm);

initgraph(&grd, &grm, ');

gresult = graphresult();

if(gresult != grOk)

{

printf(grapherrormsg(gresult));

getch();

return 0;

}

outtextxy(100,100,'softwareandfinance.com');

getch();

closegraph();

}

Output

softwareandfinance.com [in graphics screen]



Dev


Initgraph Error In Dev C Version

what is worng with this code

It shows the following:

Initgraph Error In Dev C 4


[linker error] undefined referense to initgraph(int*,int*,char*)
[linker error] undefined referense to getmaxy()
[linker error] undefined referense to getmaxy()
[linker error] undefined referense to grapherrormsg(int)
etc...........

  • 2 Contributors
  • forum 2 Replies
  • 682 Views
  • 13 Hours Discussion Span
  • commentLatest Postby Anuradha MandalLatest Post

jonsca1,059

Graphics.h Error In Dev C++

graphics.h requires a specific library that is only found on Borland compilers (I don't think the newer Borland products even have it anymore). Look up WinBGIm as a possible alternative (however, it too is quite outdated).