c++ graphics.h -lbgi not found

前端 未结 4 1032
长情又很酷
长情又很酷 2021-01-20 11:43

I have this code:

#include
int main( )
{
    initwindow( 700 , 700 , \"MY First Program\");
    circle(200, 200, 150);
    getch();
    ret         


        
相关标签:
4条回答
  • 2021-01-20 12:24

    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.

    0 讨论(0)
  • 2021-01-20 12:27

    If you are coding in C++11, You must know that <graphics.h> is deprecated in C++11. If you are compiling it in Turbo C++, you must use the initgraph() function and give the path to the BGI folder. For more details, check this out: http://www.programmingsimplified.com/c/graphics.h

    0 讨论(0)
  • 2021-01-20 12:36

    You must include the initgraph() function. Add this:

    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\TC\BGI"); //Path where BGI folder appears
    
    0 讨论(0)
  • 2021-01-20 12:48

    Perhaps your default location of compiler is not under ide folder. In this situation you have to copy graphics.h and winbgim.h in include folder and libbgi in lib folder of default location of the compiler also which may be C:\MinGW\include and C:\MinGW\lib.

    0 讨论(0)
提交回复
热议问题