'Is there any problem with my IDE or code?

I want to learn the basics of graphic.h library in cpp, but after solving a few errors with the IDE and running some codes from tutorials found on youtube I encountered another problem. After compiling and running the code, the console opens, but a new interface does not. I have used two functions for this, openwindow() and initgraph(), both with the same result. I do not know if I do something wrong. Does someone know what can I do to solve this?

IDE: CodeBlocks

Update: Some of you said that this library is a bit too old and out of support rn. Do you have any recommendations for other graphic libraries in cpp?

Code:

#include <graphics.h>
int main(void)
{
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"");
    line(100, 200, 100, 200);
    getch();
    closegraph();
    return 0;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source