V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kilasuelika
V2EX  ›  程序员

conan 使用 qt6 的 Could not find the Qt platform plugin "windows" 问题

  •  
  •   kilasuelika · 2021-10-29 18:07:28 +08:00 · 1154 次点击
    这是一个创建于 903 天前的主题,其中的信息可能已经有所发展或是发生改变。

    电脑上没有装过 qt ,想用 conan 试试。用 vs2019 ,编译是正常的,但运行时提示:

    qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    我的 conanfile.txt 是这么写的:

    [generators]
    visual_studio
    
    [requires]
    qt/6.2.1
    
    [options]
    *:shared=True
    
    [imports]
    bin, *.dll -> .
    lib, *.dylib* -> .
    

    不知道有没有小伙伴遇到过这个的。

    程序就是官网上复制的:

    #include <QtWidgets>
    
    // Include header files for application components.
    // ...
    
    int main(int argc, char* argv[])
    {
        QApplication app(argc, argv);
    
        // Set up and show widgets.
        // ...
    
        return app.exec();
    }
    

    试过用 vcpkg 装 qt ,但安装时编译失败。

    网上查到似乎与 qwindows.dll 这几个文件有关,但我是用 conan 装的,压根没看到这几个文件。

    kilasuelika
        1
    kilasuelika  
    OP
       2021-10-29 18:38:23 +08:00
    已经解决,发现是 conan 下载的 conan_package.tgz 里面有个 res/archdatadir 里面有一些文件没有复制,这里面就有 qwindows.dll.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   969 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:44 · PVG 03:44 · LAX 12:44 · JFK 15:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.