+ 3
[CLOSED] Error when trying graphics.
So I got all the stuff I need to make graphics in C++, but whenever I run the code an error shows up. "Drawing operation was attempted when there was no current window." How do I fix this?
11 Respuestas
+ 8
I suffer he same thing too... please help
+ 4
It would be hopefull if you posted the code. When you say you got all the stuff i need i assume that the error is because it wasnt set up properly.
+ 2
Ian Moore
If you want C++ graphics, I reccommend.
SDL2 or SFML ( if you do not want to use an engine)
Sdl2 - What I use :
https://www.libsdl.org/
SFML
https://www.sfml-dev.org/index.php
+ 1
put getch(); inside closegraph(); and initgraph(); it work for me
0
~ swim ~ I thought we were done with this but we're not. RIP. So now it's saying "warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]".
Here's my code:
#include<graphics.h>
#include <conio.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd,&gm, "C:\\tc\\bgi"); circle(300,300,50);
closegraph();
getch();
}
I've tried all I can... It still doesnt work. The error seems to be inside the initgraph().
0
closegraph(getch());
it solves the issue!