-1

我正在尝试编译一个基于旧graphics.h的动画程序。我从WinBGImlibbgi.a下载了及其相关的头文件,并按照此处的说明进行操作(它适用于 Codeblocks,但我尝试对 Netbeans 执行类似的步骤)。当我尝试构建它时,它在链接期间显示错误(如下所示)。

请告诉我怎么了?

在文件夹libbgi.a/lib/,其相关的头文件在/usr/include文件夹中。

代码:

#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <string.h>

int main() {
    int gdriver = DETECT, gmode, errorcode;
    initgraph(&gdriver, &gmode, (char*) "");
    errorcode = graphresult();
    /* an error occurred */
    if (errorcode != grOk) {
       printf("Graphics error: %s\n", grapherrormsg(errorcode));
       printf("Press any key to halt:");
       getch();
       exit(1);
    }

    getch();
    closegraph();
    return 0;
}

错误信息:

g++ -m64    -o dist/Debug/Cygwin-Windows/bouncingballbgi build/Debug/Cygwin-Windows/bouncing_ball.o /cygdrive/D/softwares/cygwin64/lib/libbgi.a -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libbgi.a when searching for -lbgi
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lbgi
collect2: error: ld returned 1 exit status

编辑:

按照以下步骤:

mkdir junk; cd junk
ar x /usr/lib/libbgi.a
file *.o

我得到了这个输出:

dibutil.o:   Intel 80386 COFF object file, no line number info, not stripped, 4 sections, symbol offset=0x1b7c, 44 symbols
drawing.o:   Intel 80386 COFF object file, no line number info, not stripped, 6 sections, symbol offset=0x5590, 126 symbols
file.o:      Intel 80386 COFF object file, no line number info, not stripped, 4 sections, symbol offset=0x6fc, 30 symbols
misc.o:      Intel 80386 COFF object file, no line number info, not stripped, 6 sections, symbol offset=0x1840, 83 symbols
mouse.o:     Intel 80386 COFF object file, no line number info, not stripped, 4 sections, symbol offset=0x448, 21 symbols
palette.o:   Intel 80386 COFF object file, no line number info, not stripped, 3 sections, symbol offset=0x116, 16 symbols
text.o:      Intel 80386 COFF object file, no line number info, not stripped, 8 sections, symbol offset=0x1c0c, 85 symbols
winbgi.o:    Intel 80386 COFF object file, no line number info, not stripped, 16 sections, symbol offset=0x319c, 128 symbols
winthread.o: Intel 80386 COFF object file, no line number info, not stripped, 27 sections, symbol offset=0x84fe, 130 symbols

编辑2:

在使用 32 位模式(-m32标志)编译代码时,出现以下错误:

g++ -m32    -o dist/Debug/Cygwin-Windows/bouncingballbgi build/Debug/Cygwin-Windows/bouncing_ball.o /cygdrive/D/softwares/cygwin64/lib/libbgi.a -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libgdi32.a when searching for -lgdi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libgdi32.a when searching for -lgdi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libgdi32.a when searching for -lgdi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgdi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libcomdlg32.a when searching for -lcomdlg32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libcomdlg32.a when searching for -lcomdlg32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libcomdlg32.a when searching for -lcomdlg32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcomdlg32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuuid.a when searching for -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuuid.a when searching for -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libuuid.dll.a when searching for -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuuid.a when searching for -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libuuid.dll.a when searching for -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luuid
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/liboleaut32.a when searching for -loleaut32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/liboleaut32.a when searching for -loleaut32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/liboleaut32.a when searching for -loleaut32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -loleaut32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libole32.a when searching for -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libole32.a when searching for -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libole32.a when searching for -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lole32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libstdc++.dll.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.dll.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libstdc++.dll.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.dll.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.a when searching for -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lstdc++
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libadvapi32.a when searching for -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libshell32.a when searching for -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libuser32.a when searching for -luser32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/w32api/libkernel32.a when searching for -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
4

1 回答 1

1

尽管gcc-m32 ( [GNU.GCC]: x86 Options ) 运行良好,但在Cygwin上存在一些问题。

回顾一下,您正在尝试在64 位Cygwin上构建一个32 位应用程序(使用一些32 位内置静态)。即使有一系列步骤可以让您实现目标,最简单的方法是安装32 位gcc工具链。

例子:

[cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q057461809]> ~/sopr.sh
*** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ***

[064bit prompt]> uname -a
CYGWIN_NT-10.0 cfati-5510-0 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
[064bit prompt]>
[064bit prompt]> which g++
/usr/bin/g++
[064bit prompt]> GPPS="/usr/bin/g++ /usr/bin/x86_64-pc-cygwin-g++.exe /usr/bin/i686-pc-cygwin-g++.exe"
[064bit prompt]> echo ${GPPS}
/usr/bin/g++ /usr/bin/x86_64-pc-cygwin-g++.exe /usr/bin/i686-pc-cygwin-g++.exe
[064bit prompt]>
[064bit prompt]> for GPP in ${GPPS}; do ll ${GPP}; done
-rwxr-xr-x 4 cfati None 936467 Dec  9  2018 /usr/bin/g++
-rwxr-xr-x 4 cfati None 936467 Dec  9  2018 /usr/bin/x86_64-pc-cygwin-g++.exe
-rwxr-xr-x 2 cfati None 931347 Apr 17  2018 /usr/bin/i686-pc-cygwin-g++.exe
[064bit prompt]>
[064bit prompt]> for GPP in ${GPPS}; do md5sum ${GPP}; done
71b02af056efb46a3e66279ce80e554f */usr/bin/g++
71b02af056efb46a3e66279ce80e554f */usr/bin/x86_64-pc-cygwin-g++.exe
4642d1d76335bf5394e7c0917acf13d0 */usr/bin/i686-pc-cygwin-g++.exe
[064bit prompt]>
[064bit prompt]> for GPP in ${GPPS}; do cygcheck -f ${GPP}; done
gcc-g++-7.4.0-1
gcc-g++-7.4.0-1
cygwin32-gcc-g++-7.3.0-1

正如所见,g++x86_64-pc-cygwin-g++是相同的(通常,前者应该是后者的符号链接),而i686-pc-cygwin-g++是你需要的。
安装它的包(cygwin32-gcc-g++-*及其所有依赖项(如下所示)并在尝试构建时使用该可执行文件。

克++ 032

作为替代方案,您可以安装32 位 Cygwin(这两种变体可以在同一台机器上愉快地共存——我将它们都安装在我的笔记本电脑上)并尝试在那里构建。

有关64 位/ 32 位兼容性的更多详细信息,请查看[SO]:您可以在 64 位安装中运行 32 位 Cygwin 应用程序吗?(@CristiFati 的回答)

于 2019-08-13T16:21:42.923 回答