0

I am using codeblocks 17.2 for c++ and i am struggling to successfully get an output while running a graphics program. I have added all the linker settings and files successfully but there is still a problem. When i run a basic graphics program, It compiles and runs properly but there is a blank output with this line

Process returned -1073741819 (0xC0000005) execution time : 2.891 s

Press any key to continue.

this is my code

            #include<iostream>
            #include<graphics.h>
            #include<conio.h>
            using namespace std;
            int main()
            {
                int gd = DETECT;
                int gm;
                initgraph(&gd,&gm, "C:\\TC\\BGI");
                circle(300,300,50);
                closegraph();
                getch();
            }
2
  • what BGI you are using? what OS you are running this in? what architecture 16/32/64 bit? does your port of BGI has the same architecture as compiled executable?. swapping closegraph and getch form the deleted answer is a good idea but if you are running in DOS-BOX then usually single getch is not enough as DOS-BOX clock tics is often glitching short key stroke detection like getch() try to use more of them in sequence (2,...,4)... PS gfx output should be in separate "window" not in the text console ... Also do you have compatible BGI driver at provided location?
    – Spektre
    Nov 28, 2019 at 11:53
  • return error 0xC0000005 is usually related to using NULL pointer or accessing memory that is not owned by the process (some environments produce SEGMENTATION FAULT error some ACCESS VIOLATION instead). My bet is that the BGI port of yours is 16/32 bit and you are compiling 32/64 bit executable...
    – Spektre
    Nov 28, 2019 at 11:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.