Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 交叉编译qt(linux/mingw->;windows):各种未定义的引用_C++_Qt_Mingw_Cross Compiling - Fatal编程技术网

C++ 交叉编译qt(linux/mingw->;windows):各种未定义的引用

C++ 交叉编译qt(linux/mingw->;windows):各种未定义的引用,c++,qt,mingw,cross-compiling,C++,Qt,Mingw,Cross Compiling,(来自的交叉柱,因为似乎没有人有想法) 各位好, 我正在尝试从linux为windows交叉编译Qt4.8.3。最终的目标是构建一个静态qt,但是不管构建静态与否,我总是会得到相同的错误。玩弄各种旗帜也无济于事: ./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x18dc): undefined reference to `QGb18030Codec::QGb18030Codec()' ./.obj/release-shared

(来自的交叉柱,因为似乎没有人有想法)

各位好,

我正在尝试从linux为windows交叉编译Qt4.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:。阅读有关如何交叉编译软件的文档

其要点是,您使用的不是
qmake
,而是
i686-pc-mingw32-qmake
(根据文档更改路径以包含MXE目录后)


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

只是好奇,为什么交叉编译而不在windows中构建?我所有的开发都是在linux上进行的,但是在一个小的windows虚拟机上使用QtCreator保留了一个完整的qt/mingw工具链,以便在那里构建可部署的二进制文件。比交叉编译或尝试处理VSW容易得多目前我这里只有linux+mingw,尽管在windows上设置mingw是我的备用解决方案。请尝试这里的建议:您的问题应该通过我类似的黑客解决。