MinGW,链接到Windows上的dll

MinGW, linking to a dll on Windows

本文关键字:上的 dll Windows 链接 MinGW      更新时间:2023-10-16

我正在尝试在示例程序中使用从相机供应商处收到的库。我有一个.dll和一个用于库的 .lib 文件。我的编译命令是:

g++  -o "Win32App.exe" -L"....SK developSK91GigE-WINLib" obj/winmain.o obj/callbacks.o obj/resource.o -s -lcomctl32 -Wl,--subsystem,windows -lSK91GigE_x64

我得到:

obj/winmain.o:winmain.cpp:(.text+0x292): undefined reference to `SK_LOADDLL'
collect2.exe: error: ld returned 1 exit status

看看带有 nm 的 .lib 显示:

BFD: SK91GigE_x64.lib(SK91GigE_x64.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive 
nm: SK91GigE_x64.dll: File format not recognized

对于 DLL,它输出:

nm: SK91GigE_x64.dll: File format not recognized

任何想法如何修改该库以包含它?

Windows 路径

变量指向 32 位 MinGW。 将路径设置为 64 位版本的 MinGW 解决了这个问题。我没有检查