找不到-lbgi和ld返回1个退出状态错误

时间:2019-05-12 12:54:22

标签: c++ mingw project dev-c++ bgi

我正在尝试使用dev c ++在c ++图形中画线,这是代码

// C++ Implementation for drawing line 
#include <graphics.h> 

// driver code 
int main() 
{ 
    // gm is Graphics mode which is a computer display 
    // mode that generates image using pixels. 
    // DETECT is a macro defined in "graphics.h" header file 
    int gd = DETECT, gm; 

    // initgraph initializes the graphics system 
    // by loading a graphics driver from disk 
    initgraph(&gd, &gm, ""); 

    // line for x1, y1, x2, y2 
    line(150, 150, 450, 150); 

    // line for x1, y1, x2, y2 
    line(150, 200, 450, 200); 

    // line for x1, y1, x2, y2 
    line(150, 250, 450, 250); 

    getch(); 

    // closegraph function closes the graphics 
    // mode and deallocates all memory allocated 
    // by graphics system . 
    closegraph(); 
} 

但是以下错误在编译中一次又一次地显示出来,我不确定如何解决这些错误。

C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/libbgi.a when searching for -lbgi
C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib/libbgi.a when searching for -lbgi
C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../libbgi.a when searching for -lbgi
C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lbgi
collect2.exe: error: ld returned 1 exit status

C:\Program Files (x86)\Dev-Cpp\Makefile.win:25: recipe for target 'Project1.exe' failed
mingw32-make.exe: *** [Project1.exe] Error 1

错误截图

我尝试将它们包含在项目参数链接器选项卡中

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

此外,我在devc ++文件夹中有graphics.h库。但不确定为什么此错误不断弹出。请有人指出我的错误。

0 个答案:

没有答案