【问题标题】:Qt Visual Studio 2015 Add-in compilation problemQt Visual Studio 2015 插件编译问题
【发布时间】:2020-10-10 21:28:25
【问题描述】:

我在我的项目中使用 Qt 插件。但我不明白,我做错了什么。

我的 .pro 文件:

QT       += core gui network
TEMPLATE = app
TARGET = MMworker
DESTDIR = ../Debug
CONFIG += debug
LIBS += -L"../../../../boost_1_70_0/stage/lib"
DEPENDPATH += .
MOC_DIR += .
OBJECTS_DIR += debug
UI_DIR += .
RCC_DIR += .

得到很多错误。例如

Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall QHostAddress::QHostAddress(void)" (__imp_??0QHostAddress@@QAE@XZ) referenced in function...
Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __thiscall QHostAddress::setAddress(class QString const &)" (__imp_?setAddress@QHostAddress@@QAE_NABVQString@@@Z) referenced in function ...
Error   LNK2019 unresolved external symbol "public: void __thiscall TcpServer::connectToServer(class QHostAddress,int)" (?connectToServer@TcpServer@@QAEXVQHostAddress@@H@Z) referenced in function...
Error   LNK2019 unresolved external symbol "public: bool __thiscall MainTimer::timeAfterMomentExceeds(__int64,__int64)" (?timeAfterMomentExceeds@MainTimer@@QAE_N_J0@Z) referenced in function ...
Error   LNK2019 unresolved external symbol "private: __int64 __thiscall MainTimer::getMilliseconds(void)" (?getMilliseconds@MainTimer@@AAE_JXZ) referenced in function "public: __int64 __thiscall MainTimer::time_ms(void)" (?time_ms@MainTimer@@QAE_JXZ)...
Error   LNK2019 unresolved external symbol "public: void __thiscall Channel::readData(class QString &)" (?readData@Channel@@QAEXAAVQString@@@Z) referenced in function ...
Error   LNK2001 unresolved external symbol "public: virtual void * __thiscall SimpleDevice::qt_metacast(char const *)" (?qt_metacast@SimpleDevice@@UAEPAXPBD@Z)...

P.S.:我也在看 qt simple tcp communication with ui projects 。我不明白我怎么能“你需要启用你在 Qt 项目设置中使用的模块”。

UPD1:编译成功,但构建仍在下降。

【问题讨论】:

  • 我的插件也遇到了一些问题;我什至无法找出其他人何时拥有它,但无论如何让我们尝试一下。我假设您还没有设法运行任何项目。 1)检查您是否已正确安装 QtCreator - 即使您不会打开应用程序,VS 也有必要工作 - 我相信。 2) 运行 Path/To/Qt/MaintenanceTool.exe 并查看是否安装了必要的模块。一个标准的 WidgetsApplication 需要 corewidgetgui 模块。你的已经包含network,所以你应该确保它也包含在内。
  • 旁边;我从不编辑我的 VS 生成的 .pro 文件,只是因为它似乎根本不起作用。如果我需要来自项目设置中未包含的新模块的标头,我总是会遇到麻烦,因此请确保一开始就包含所有内容。同时,我应该了解如何在项目设置后添加库。
  • 如何检查 MaintenanceTool.exe 模块的可用性?我只看到编译器的不同变体...
  • 如果我打开维护工具(它要求我先进行更新),我单击“添加/删除组件”,然后我可以看到所有 Qt 版本。例如,我有 Qt 5.14.1。然后我可以展开我拥有我的模块的版本并看到“Android、MSVC ...”,但如果我再看一点,我也可以看到“Qt Charts”、“Qt Data Visualization”。这些是可选的模块。其中一个名为“Qt Network Authorization”,所以我认为您需要那个(我不确定,因为我总是很难找到模块名称)。当然,您可以使用最新版本 5.15.0 而不是 5.14.1。

标签: c++ visual-studio qt visual-studio-2015 add-in


【解决方案1】:

错误在于包括附加依赖项(已删除)并包含目录(已添加)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-21
    • 1970-01-01
    • 2011-04-15
    相关资源
    最近更新 更多