how to fix this problem?

when i use graphics in C++ it shows following warning:
[Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]

so how to fix this problem? or is there any other way for graphics without using graphics.h?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// C++ programme for drawing line
#include <graphics.h>
 

int main()
{

    int gd = DETECT, gm;
 
    // initgraph initializes the graphics system
    // by loading a graphics driver from disk
    initgraph(&gd, &gm, "");
 
    // line for x1, y1, x2, y2
    line(150, 150, 450, 150);
 
    // line for x1, y1, x2, y2
    line(150, 200, 450, 200);
 
    // line for x1, y1, x2, y2
    line(150, 250, 450, 250);
 
    getch();
 
    closegraph();
}
Try this:initgraph(&gd, &gm, NULL);

graphics.h is totally outdated.
A newer alternative: https://github.com/Duthomhas/WinBGIm-fixed-sort-of-
Thank you Thomas1965,
it really worked but it created an other problem,
it shows following errors:
undefined reference to 'initgraph'
undefined reference to 'line'
undefined reference to 'closegraph'
[Error] Id returned 1 exit status.
I use DevC++.
try it into C or DEV C++, this code run there without any bug, if there any bug appear, you may take a solution from https://supportantivirus.org/quick-heal-antivirus-customer-service/
Thank you Thomas, I Think now I am near to the success,
I Did not had the winbgim.h, so and lib.a so I downloded and put as it was directed, but still the problem is not solved,
The Compiler (DevC++ 5.11) Shows same Errors as I have mentioned above.
Topic archived. No new replies allowed.