User forums > Help
how use Graphics.h?
cambalinho:
i use CodeBlocks with mingw compiler.
for use 'Graphics.h', i must add the 'libbgi.a' library.
but i continue with some compiler\linker error: "ld.exe||cannot find -lbgi|".
yes i add the linker options:
"-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32"
heres my testing code:
--- Code: ---#include <iostream>
#include <graphics.h>
#include <conio.h>
using namespace std;
int main()
{
int gdriver = DETECT, gmode;
int x1 = 200, y1 = 200;
int x2 = 300, y2 = 300;
//clrscr();
initgraph(&gdriver, &gmode, NULL);
line(x1, y1, x2, y2);
getch();
closegraph();
return 0;
}
--- End code ---
(i need find, too, the another 'conio.h' too)
maybe the problem it can the library compatibly :(
Miguel Gimenez:
Where is libbgi.a? Probably you must add the path to the linker search paths.
Linking problems are best solved if you post a full rebuild log.
cambalinho:
heres the print:
https://imgur.com/07SJvb7
Miguel Gimenez:
Does libbgi.a exist in the lib folder?.
You are adding libbgi.a twice. All the "Other linker options" content should be moved to the left with no paths:
--- Code: ---libbgi.a
libgdi32.a
..
--- End code ---
The full rebuild log is far better than an image, post it (in code tags) if you have more problems.
cambalinho:
because the 'libbgi.a' is for the 'graphics.h'.
on past i put it to work... but now i can't :(
Navigation
[0] Message Index
[#] Next page
Go to full version