mingw-w64 - 与 MinGW 交叉编译时 GetSaveFileName 链接失败

标签 mingw-w64

我正在尝试编译 UniLogger 的修改版本在 Ubuntu 18.04 上使用 mingw。我收到以下链接错误:

undefined reference to '_imp__GetSaveFileNameW@4'

我找到了this post on the MinGW mailing list说需要显式链接到 comdlg32 所以我也尝试了:

i686-w64-mingw32-g++ -municode -o unilogger.exe -lcomdlg32 Source.cpp

但仍然遇到同样的错误,就像帖子中提问的人一样。他和我都验证了 lib 文件中该函数的存在:

nm /usr/i686-w64-mingw32/lib/libcomdlg32.a

libcomdlg32s00012.o:
00000000 b .bss
00000000 d .data
00000000 T _GetSaveFileNameW@4
         U __head_lib32_libcomdlg32_a
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00000000 i .idata$7
00000000 I __imp__GetSaveFileNameW@4
00000000 t .text

libcomdlg32s00011.o:
00000000 b .bss
00000000 d .data
00000000 T _GetSaveFileNameA@4
         U __head_lib32_libcomdlg32_a
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00000000 i .idata$7
00000000 I __imp__GetSaveFileNameA@4
00000000 t .text

此时我有点不知所措。

最佳答案

好的,找出问题所在 - 命令行上的争论顺序:

i686-w64-mingw32-g++ -lcomdlg32 -municode -o unilogger.exe

但是给出了链接错误

i686-w64-mingw32-g++ -municode -o unilogger.exe -lcomdlg32

编译得很好。事实上,我以前在使用 gcc 时遇到过这个问题,现在我想起来了......

关于mingw-w64 - 与 MinGW 交叉编译时 GetSaveFileName 链接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54095214/

相关文章:

c++ - 使用 MinGW-w64 为 Windows 编译 LAPACK

python - 我已经安装了MSYS2和Anaconda3,那么如何在MSYS2上使用conda呢?

c - 在 Windows 7 中使用 MinGW-w64 编译 C 代码时出错

c++ - mingw-w64 和 SDL2 链接问题

c - MinGW-W64:我必须/应该使用哪些安装选项(架构、线程等)进行原生 Windows 开发

c++ - 尝试使用 Opencv 和 QT 构建测试

c++ - 无法在 Mingw-w64 中使用 "uniform_int_distribution",但 "exponential_distribution"可以使用

c - 如何在windows 10的sublime text 3中编译运行C程序?

c++ - 错误: sigjmp_buf does not name a type. When Compiling my project with Poco C++ libraries

c++ - 在 MinGW 中使用线程?