-1

I added the full library graphic.h, winbgim.h, libbgi.a and its path in linker setting and other linker but it didn't work and it showed an error:

ld.exe cannot find -lbgi
genpfault
  • 51,148
  • 11
  • 85
  • 139

1 Answers1

1

ld will give you that error if it can't find libbgi.a for static builds or libbgi.dll.a shared builds.

Make sure the path containing libbgi.a is set it the linker paths as in this screenshot: enter image description here

Another thing you could try is to build a static version of your project in order to avoid using a missing shared library.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40
  • Can you list the exact contents of the that folder you put in there? And what exactly is the error message? Are you sure the library file you are trying to uses matches your architecture (you're not mixing win32 and win64)? – Brecht Sanders Jul 30 '20 at 07:31
  • graphic.h and winbgim.h: I put in **C:\Program Files (x86)\CodeBlocks\MinGW\x86_64-w64-mingw32\include**. The exact error message is: > ld.exe cannot find -lbgi I use **win64** – dinhthanh1804 Jul 31 '20 at 01:53
  • Just dropping stuff into the MinGW folder is not the best idea. Better is to put this in a folder containing 3rd party libraries and adding the `include` folder to the compiler search directories and the `lib` folder to the linker search directories in your Code::Blocks project or even in the Code::Blocks compiler settings. – Brecht Sanders Jul 31 '20 at 12:27