Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt5-base:x64-windows-static link error #44656

Open
nblwdlt opened this issue Mar 27, 2025 · 5 comments
Open

qt5-base:x64-windows-static link error #44656

nblwdlt opened this issue Mar 27, 2025 · 5 comments
Assignees
Labels
requires:repro The issue is not currently repro-able

Comments

@nblwdlt
Copy link

nblwdlt commented Mar 27, 2025


name: Other type of bug report
about: Let us know about an issues that does not fit into any of the other issues.
types
title: 'link error'
labels: 'qt5-base:x64-windows-static'
assignees: ''



Describe the bug
When creating a Qt Widgets Application project, the linker cannot automatically import qtmain.lib or qtmaind.lib. They need to be manually added, otherwise an error will be reported.

Environment

  • OS: [Windows 10 x64]
  • Compiler: visual studio 2022 17.13.5
    Qt Visual Studio Tools Version:3.3.1.1
    vcpkg package management program version 2025-03-22-d4dd14112c2026ee57e59f966ecfa3b9137bd143

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install qt5-base:x64-windows-static
  2. Open VS2022
    3.Create QT project: Qt Widgets Application,Base calss:QMainWindow.
  3. Active(debug x64):vcpkg->Use Static Libraries = YES
  4. Active(debug x64):C/C++->Code Generation->Runtime Library=Multi-threaded Debug(MTD)
    When compiling a project

Expected behavior
Compile and generate a static library version of the Qt window program.

Failure logs
1>Reading Qt configuration (D:/vcpkg/buildtrees/qt5-base/x64-windows-static-dbg/bin/qmake)
1> Qt: 5.15.16
1>uic QtWidgetsApplication6.ui
1>rcc QtWidgetsApplication6.qrc
1>moc QtWidgetsApplication6.h
1> RCC: Warning: No resources in 'D:\Source\VS\QtWidgetsApplication6\QtWidgetsApplication6.qrc'.
1>QtWidgetsApplication6.cpp
1>main.cpp
1>qrc_QtWidgetsApplication6.cpp
1>moc_QtWidgetsApplication6.cpp
1>qtvars_plugin_import.cpp
1>Qt5AxServerd.lib(qaxserver.obj) : error LNK2019: unresolved external symbol "class QAxFactory * __cdecl qax_instantiate(void)" (?qax_instantiate@@YAPEAVQAxFactory@@xz) referenced in function "class QAxFactory * __cdecl qAxFactory(void)" (?qAxFactory@@YAPEAVQAxFactory@@xz)
1>D:\Source\VS\QtWidgetsApplication6\x64\Debug\QtWidgetsApplication6.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "QtWidgetsApplication6.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 0:06 and took 05.348 seconds ==========


@nblwdlt
Copy link
Author

nblwdlt commented Mar 27, 2025

Of course, qt5 tools has already been installed.

@nblwdlt
Copy link
Author

nblwdlt commented Mar 27, 2025

I haven't added any of my own code.

@JonLiu1993 JonLiu1993 added the requires:repro The issue is not currently repro-able label Mar 28, 2025
@nblwdlt
Copy link
Author

nblwdlt commented Mar 28, 2025

复制什么?我就是用vcpkg直接install了qt5-base,并且安装了qt5-tools,然后进行了全局集成,创建了qt桌面窗口程序,然后只要不在链接器中的输入里,添加qtmain.lib就无法编译通过,还要复制什么?

@nblwdlt
Copy link
Author

nblwdlt commented Mar 28, 2025

问题我现在可以解决,就是在链接器里的输入内,添加qtmain.lib,但我只是觉得在旧的版本中不需要这么操作,还要求复制,有啥可复制的。

@nblwdlt
Copy link
Author

nblwdlt commented Mar 28, 2025

解决的了就解决,解决不了也无所谓,我是可以克服,只是说下这个问题而已。其他都随便吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able
Projects
None yet
Development

No branches or pull requests

2 participants