在 Windows 上编译静态 Qt 版本时未定义的引用

发布于 2024-09-07 05:10:26 字数 1690 浏览 2 评论 0原文

我想在Windows平台(Windows XP SP3)上编译Qt工具包的静态版本。我下载了 Windows 的最新版本并成功安装。然后我从“开始”菜单打开 Qt 4.6.3 命令提示符并调用:

configure -static -release -nomake Examples -nomake demos -fast

配置执行良好,并且 mingw32 的第一部分-make 也是如此。在某些时候,我得到了很多未定义的引用:

mingw32-make[4]: 进入目录 `C:/Qt-static/4.6.3/src/tools/moc'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_MOC -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_TEXTCODEC -DQT_NO_CAST_FROM_AS CII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTST REAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NODLL -I” ." -I"." -I"......\include" -I"......\include\QtCore" -I"......\include\Qt XML" -I"....\xml" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.x 1\include" -I"......\mkspecs\win32-g++" -o release\moc.o moc.cpp

...

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -Wl,-子系统,控制台 -mthreads -Wl -o ......\bin\moc.exe release/m oc.o 发布/预处理器.o 发布/generator.o 发布/parser.o 发布/token.o 发布/main.o -L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\ Lib\" -LC:/Qt-static/4.6.3/src/tools/bootstrap/release -lbootstrap -luser32 release/moc.o:moc.cpp:(.text+0x14b): 对 QByteArray::shared_ 的未定义引用 空'
release/moc.o:moc.cpp:(.text+0x150): 对 QByteArray::shared_ 的未定义引用 空'
release/moc.o:moc.cpp:(.text+0x156): 对 `QByteArray::shared_ 的未定义引用

...

未定义引用的列表实际上要长得多。

这是在相当默认的 Windows 安装中开箱即用的。我想知道是否我做错了什么或者工具包中有错误。

I'd like to compile a static version of the Qt toolkit on the Windows platform (Windows XP SP3). I downloaded the latest release for Windows and successfully installed it. Then I opened the Qt 4.6.3 Command Prompt from the Start menu and invoked:

configure -static -release -nomake examples -nomake demos -fast

Configuration executes fine, and the first part of mingw32-make as well. At some point I get a lot of undefined references:

mingw32-make[4]: Entering directory `C:/Qt-static/4.6.3/src/tools/moc'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_MOC -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_TEXTCODEC -DQT_NO_CAST_FROM_AS
CII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT
-DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTST
REAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NODLL -I"
." -I"." -I"......\include" -I"......\include\QtCore" -I"......\include\Qt
Xml" -I"....\xml" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.
1\include" -I"......\mkspecs\win32-g++" -o release\moc.o moc.cpp

...

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o ......\bin\moc.exe release/m
oc.o release/preprocessor.o release/generator.o release/parser.o release/token.o
release/main.o -L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\
Lib\" -LC:/Qt-static/4.6.3/src/tools/bootstrap/release -lbootstrap -luser32
release/moc.o:moc.cpp:(.text+0x14b): undefined reference to QByteArray::shared_
null'
release/moc.o:moc.cpp:(.text+0x150): undefined reference to
QByteArray::shared_
null'
release/moc.o:moc.cpp:(.text+0x156): undefined reference to `QByteArray::shared_

...

The list of undefined references is actually much longer.

This is out of the box on a pretty default Windows installation. I wonder whether I'm doing something wrong or there's a bug in the toolkit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷梦 2024-09-14 05:10:26

我也有类似的问题。就我而言,Visual Studio 设置了环境参数
INCLUDELIB 混淆了 make。

从命令行禁用它们。

set INCLUDE=
set LIB=

解决方案是在编译 Qt 库之前

I had similar problems. In my case Visual Studio had set environment parameters
INCLUDE and LIB which confused the make.

The solution was to disable them from the command line

set INCLUDE=
set LIB=

before compiling the Qt libraries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文