MinGW-W64 链接器在搜索第三方静态库时跳过不兼容的文件

MinGW-W64 linker skipping incompatible files when searching for third-party static libraries

我使用的是 Windows 7 64 位,我正在使用来自 MinGW-W64 的 g++ 进行编译。

我正在尝试编译我在 Unix 计算机上编写的应用程序。但是,当我尝试 link 针对某些第三方 lib<name>.lib 文件时,我 运行 遇到了问题。具体来说,我需要 link 到 ROOT 个库。 linker 吐出诸如

之类的错误
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibGui

我完全不知所措。我已经尝试在各种不同的配置中多次重新安装 MinGW-W64,摆弄我的 -L 和 -l 标签,重命名库,明确写出它们的完整路径等等。我可以得到不同的错误,但总是报错。

我正在使用下面的批处理文件进行编译。

@echo off

set g++=C:\Users\jroth\Data\nest3\mingw64\bin\g++

set rootconfig=-pthread -m64 -IC:/root/root_v5.34.28/include -LC:/root/root_v5.34.28/lib -llibGui -llibCore -llibCint -llibRIO -llibNet -llibHist -llibGraf -llibGraf3D -llibGpad -llibTree -llibRint -llibPostscript -llibMatrix -llibPhysics -llibMathCore -llibThread -pthread -lm -ldl

%g++% -std=c++0x -Wall -o online_monitor.exe main.cpp external_input.o periodic_dinger.o flagger.o monitor.o %rootconfig%

运行宁的结果是

C:\Users\jroth\Data\online_monitor v.0.5>make.bat
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libGui.lib when searching for -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibGui
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libCore.lib when searching for -llibCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libCore.lib when searching for -llibCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libCore.lib when searching for -llibCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libCint.lib when searching for -llibCint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libCint.lib when searching for -llibCint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libCint.lib when searching for -llibCint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibCint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libRIO.lib when searching for -llibRIO
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libRIO.lib when searching for -llibRIO
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libRIO.lib when searching for -llibRIO
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibRIO
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libNet.lib when searching for -llibNet
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libNet.lib when searching for -llibNet
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libNet.lib when searching for -llibNet
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibNet
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libHist.lib when searching for -llibHist
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libHist.lib when searching for -llibHist
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libHist.lib when searching for -llibHist
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibHist
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGraf.lib when searching for -llibGraf
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGraf.lib when searching for -llibGraf
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libGraf.lib when searching for -llibGraf
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibGraf
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGraf3D.lib when searching for -llibGraf3D
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGraf3D.lib when searching for -llibGraf3D
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libGraf3D.lib when searching for -llibGraf3D
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibGraf3D
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGpad.lib when searching for -llibGpad
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libGpad.lib when searching for -llibGpad
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libGpad.lib when searching for -llibGpad
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibGpad
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libTree.lib when searching for -llibTree
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libTree.lib when searching for -llibTree
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libTree.lib when searching for -llibTree
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibTree
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libRint.lib when searching for -llibRint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libRint.lib when searching for -llibRint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libRint.lib when searching for -llibRint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibRint
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libPostscript.lib when searching for -llibPostscript
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libPostscript.lib when searching for -llibPostscript
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libPostscript.lib when searching for -llibPostscript
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibPostscript
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libMatrix.lib when searching for -llibMatrix
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libMatrix.lib when searching for -llibMatrix
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libMatrix.lib when searching for -llibMatrix
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibMatrix
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libPhysics.lib when searching for -llibPhysics
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libPhysics.lib when searching for -llibPhysics
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libPhysics.lib when searching for -llibPhysics
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibPhysics
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libMathCore.lib when searching for -llibMathCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libMathCore.lib when searching for -llibMathCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libMathCore.lib when searching for -llibMathCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibMathCore
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libThread.lib when searching for -llibThread
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib/libThread.lib when searching for -llibThread
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/root/root_v5.34.28
/lib\libThread.lib when searching for -llibThread
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibThread
C:/Users/jroth/Data/nest3/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../
../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
C:\Users\jroth\Data\online_monitor v.0.5>

g++ -v的结果是

C:\Users\jroth\Data\online_monitor v.0.5>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/Users/jroth/Data/nest/mingw64/bin/../libexec/gcc/x86_64-w
64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --host=x86_64-w64-mingw32 --bu
ild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysr
oot=/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64 --with-gxx-include-dir=/
mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable
-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdc
xx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-
lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --
enable-version-specific-runtime-libs --disable-isl-version-check --disable-libst
dcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-
win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --
with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-z
lib --with-gmp=/c/mingw510/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/
c/mingw510/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw510/prereq
uisites/x86_64-w64-mingw32-static --with-isl=/c/mingw510/prerequisites/x86_64-w6
4-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 pr
oject' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
 -I/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64/opt/include -I/c/mingw510
/prerequisites/x86_64-zlib-static/include -I/c/mingw510/prerequisites/x86_64-w64
-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw510/x86_64-510-posix-seh-
rt_v4-rev0/mingw64/opt/include -I/c/mingw510/prerequisites/x86_64-zlib-static/in
clude -I/c/mingw510/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= L
DFLAGS='-pipe -L/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64/opt/lib -L/c
/mingw510/prerequisites/x86_64-zlib-static/lib -L/c/mingw510/prerequisites/x86_6
4-w64-mingw32-static/lib '
Thread model: posix
gcc version 5.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

我 运行 objdump.exe -xlibGui.lib 离开了

libGui.dll:     file format pe-i386
--------- 0/0    276 Mar 25 09:43 2015 libGui.dll
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

Characteristics 0x100
        32 bit words

Time/Date               Wed Mar 25 09:43:50 2015
Magic                   0000
MajorLinkerVersion      0
MinorLinkerVersion      0
SizeOfCode              00000000
SizeOfInitializedData   00000000
SizeOfUninitializedData 00000000
AddressOfEntryPoint     00000000
BaseOfCode              00000000
BaseOfData              00000000
ImageBase               00000000
SectionAlignment        00000000
FileAlignment           00000000
MajorOSystemVersion     0
MinorOSystemVersion     0
MajorImageVersion       0
MinorImageVersion       0
MajorSubsystemVersion   0
MinorSubsystemVersion   0
Win32Version            00000000
SizeOfImage             00000000
SizeOfHeaders           00000000
CheckSum                00000000
Subsystem               00000000        (unspecified)
DllCharacteristics      00000000
SizeOfStackReserve      00000000
SizeOfStackCommit       00000000
SizeOfHeapReserve       00000000
SizeOfHeapCommit        00000000
LoaderFlags             00000000
NumberOfRvaAndSizes     00000000

The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00000000 00000000 Import Directory [parts of .idata]
Entry 2 00000000 00000000 Resource Directory [.rsrc]
Entry 3 00000000 00000000 Exception Directory [.pdata]
Entry 4 00000000 00000000 Security Directory
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 Debug Directory
Entry 7 00000000 00000000 Description Directory
Entry 8 00000000 00000000 Special Directory
Entry 9 00000000 00000000 Thread Storage Directory [.tls]
Entry a 00000000 00000000 Load Configuration Directory
Entry b 00000000 00000000 Bound Import Directory
Entry c 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Delay Import Directory
Entry e 00000000 00000000 CLR Runtime Header
Entry f 00000000 00000000 Reserved

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .debug$S      00000040  00000000  00000000  0000008c  2**0
                  CONTENTS, READONLY, DEBUGGING
  1 .idata      00000004  00000000  00000000  000000cc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .idata      00000004  00000000  00000000  000000d0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
[  0](sec -1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00dd7725 @comp.id
[  1](sec  2)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ⌂libGui_NULL_THUNK_DAT
A


BFD: C:\root\root_v5.34.28\lib\libGui.lib(libGui.dll): Recognised but unhandled
machine type (0x14c) in Import Library Format archive

实际上我遇到过很多次这样的事情,最后我按了 Ctrl-C,但无论如何。 . .这让我觉得这些库是 32 位的。我认为这可能是个问题,但我不确定如何解决。在 g++ 上使用 -m32 选项使其拒绝所有 C++ 标准库。

我想我只有这些了。 . .如果有帮助,我非常愿意提供更多信息,在此先非常感谢您的帮助。

问题很可能是这些库是用 VC++ 编译的,所以它们显然与 GCC 不兼容。他们 link 使用 Microsoft 的 link.exe.

很好

从 objdump.exe 转储的消息来看,您需要 link 的库是 32 位的,而从 gcc (x64) 生成的 *.o 文件是 64 位的,所以是不兼容的。我认为你需要安装 MinGW 32 位版本。

继续杜方庆的回答:

如果您的活动构建系统不支持 MINGW32 构建,您需要安装它,例如从 Mingw32 @ SourceForge。您可能希望将 64 位构建系统保留为默认值。然后你需要告诉构建配置支持 mingw32-runtime:

  • 定义构建变量 ${MINGW32_HOME},使得 ${MINGW32_HOME}\bin 包含编译器二进制文件
  • 在 PATH 变量之前加上 ´${MINGW32_HOME}\bin;´
  • 在 header 之前包含路径列表 ´${MINGW32_HOME}\include;´

这在 Eclipse 中对我有用 CDT;其他项目和配置未触及。