graphics.h -lbgi not found

501 Views Asked by At

We are using Code::Blocks (version 20.03) to learn programming in C. For homework we shall implement with the grahics.h library. But installing this library comes along very hard for me.

I already downloaded the needed files from https://winbgim.codecutter.org/, changed the code in graphics.h in line 302 from "right" to "top", https://winbgim.codecutter.org/. Then I put the files in to the supposedly right folders (according to this Video: https://www.youtube.com/watch?v=VEkAj-xVTKQ).

After a long run I fixed the error "Cannot open include file: 'graphics.h': No such file or directory" by adding the directories of all added files under Settings --> Compiler --> Search directories --> Compiler and using a .cpp-file.

Now I wanted to test with the following small programm:

#include <stdio.h>
#include <graphics.h>

int main()
{
    initwindow( 700, 700, "MY First Program");
    circle(200, 200, 150);
    getch();
    return 0;
}

Now I get the error: "cannot find -lbgi error: ld returned 1 exit status"

I already tried for six hours to find a solution but I cannot find one which helps.

  • #include "graphics.h" does not make a difference

It would be great if someone knows a solution and would be so kind and share it with me. Thank you!

1

There are 1 best solutions below

0
ali On

Compiler must be 32bit not 64 bit watch this video to understand

https://youtu.be/VEkAj-xVTKQ