c++ - 交叉编译qt(linux/mingw -> windows): various undefined references

标签 c++ qt mingw cross-compiling

(来自 here 的交叉帖子,因为似乎没有人知道)

大家好,

我正在尝试从 Linux 为 Windows 交叉编译 qt 4.8.3。最终目标是构建静态qt,但与是否构建静态无关我总是得到相同的错误。使用各种标志也没有帮助:

./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x18dc): undefined reference to `QGb18030Codec::QGb18030Codec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x18ef): undefined reference to `QGbkCodec::QGbkCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1902): undefined reference to `QGb2312Codec::QGb2312Codec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1915): undefined reference to `QEucJpCodec::QEucJpCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1928): undefined reference to `QJisCodec::QJisCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x193b): undefined reference to `QSjisCodec::QSjisCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1956): undefined reference to `vtable for QEucKrCodec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1971): undefined reference to `vtable for QCP949Codec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x198c): undefined reference to `vtable for QBig5Codec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x19a7): undefined reference to `vtable for QBig5hkscsCodec'

我将默认的 win32-g++ 配置文件与 mingw 结合使用。

我用谷歌搜索了很多,但我仍然不知道这是从哪里来的..也许你们中的某个人给了我正确的提示;-)

最佳答案

您可以使用 MXE 来构建它。这很容易。您只需执行以下操作:

make qt

它几乎自动完成所有事情,包括下载源代码、应用所需的补丁以启用交叉编译(这可能就是您自己手动交叉编译 Qt 失败的原因)以及构建所有依赖项。您可以从以下位置下载 MXE:http://mxe.cc 。当然,请阅读有关如何使用它交叉编译软件的文档。

其要点是,您使用 i686-pc-mingw32-qmake 而不是 qmake (在更改 PATH 以包含 MXE 目录之后,如下所示)根据文档。)

MXE 将所有内容构建为静态库,因此当您交叉编译程序时,您将获得一个 .exe 文件,不依赖于任何 DLL。

关于c++ - 交叉编译qt(linux/mingw -> windows): various undefined references,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13036895/

相关文章:

c++ - 寻求明确的解释 : throw() and stack unwinding

python - PYQT:如何捕获python解释器的输出并将其显示在QEditText中?

c++ - 链接时未定义对 CryptoPP::AlignedAllocate 的引用

c++ - Qt QHBoxLayout 问题?

c++ - 将 Boost Serialize 与 Qt 插件一起使用

mysql - 使用嵌入qt的mysql?

c++ - 在公共(public)领域发布QT应用程序

c++ - 由于 sizeof() 无法输出 int

c++ - MinGW pacman -Sys 无法锁定数据库

c++ - 将指针绑定(bind)到 C++ 中的成员运算符