c++bgi

c++ graphics.h -lbgi not found


I have this code:

#include<graphics.h>
int main( )
{
    initwindow( 700 , 700 , "MY First Program");
    circle(200, 200, 150);
    getch();
    return 0;
}

but I get this error:

ld||cannot find -lbgi|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

I added it to linker options and also the other things.

What should I do?


Solution

  • Download this and put it in your C compiler's lib folder. Also do not forget to add in the linkers:

    -lbgi
    -lgdi32
    -lcomdlg32
    -luuid
    -loleaut32
    -lole32
    

    After doing above, you would get the actual compile error belonging to initgraph() or other.

    It is worked for me in Codeblocks 13.12.