Results 1 to 4 of 4

Thread: Deploying a QApplication inside a DLL -> platform plugin not found even if here

  1. #1
    Join Date
    Aug 2020
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Question Deploying a QApplication inside a DLL -> platform plugin not found even if here

    Hello everybody,

    I am developing a C++ graphical project using Qt5.14.2 for the GUI.
    This project has to be a DLL, because it's loaded in Microstation, a well known CAD software. Everything works fine on my computer, and the project is almost done.
    I sucessfully managed to do what needs to be done for a DLL : my QApplication is a singleton, the event loop run in a different Qthread, etc. It works!

    I first deployed the DLL on my own computer, thanks to windeployqt.exe, and it worked really fine.
    Now the problem, I did the same deployment on a test machine, in order to simulate a production environment. Microstation shows me the well known error message "This application failed to start because not Qt platform plugin could be initialized", even if all the Qt's DLLs are here. I suppose it worked on my computer because of QT_PATH. But now this path variable is no more, the project don't seems to find any of the Qt DLL deployed. Is it because they are not in the same folder as Microstation.exe?

    Here my deployed folders :
    Qt Code:
    1. Project folder
    2. |- D3Dcompiler_47.dll
    3. |- libEGL.dll
    4. |- libGLESv2.dll
    5. |- Myproject.dll
    6. |- opengl32sw.dll
    7. |- Qt5Core.dll
    8. |- Qt5Gui.dll
    9. |- Qt5Svg.dll
    10. |- Qt5Widgets.dll
    11. |
    12. L___ iconengines
    13. | |- qsvgicon.dll
    14. |
    15. L___ imageformats
    16. | |- qgif.dll
    17. | |- qicns.dll
    18. | |- qico.dll
    19. | |- qjpeg.dll
    20. | |- qsvg.dll
    21. | |- qtga.dll
    22. | |- qtiff.dll
    23. | |- qwbmp.dll
    24. | |- qwebp.dll
    25. |
    26. L___ platforms
    27. | |- qwindows.dll
    28. |
    29. L___ styles
    30. | |- qwindowsvistastyle.dll
    31. |
    32. L___ translations
    33. |- qt_ar.qm
    34. |- qt_bg.qm
    35. |- qt_ca.qm
    36. |- qt_cs.qm
    37. |- qt_da.qm
    38. |- qt_de.qm
    39. |- qt_en.qm
    40. |- qt_es.qm
    41. |- qt_fi.qm
    42. |- qt_fr.qm
    43. |- qt_gd.qm
    44. |- qt_he.qm
    45. |- qt_hu.qm
    46. |- qt_it.qm
    47. |- qt_ja.qm
    48. |- qt_ko.qm
    49. |- qt_lv.qm
    50. |- qt_pl.qm
    51. |- qt_ru.qm
    52. |- qt_sk.qm
    53. |- qt_uk.qm
    54. |- qt_zh_TW.qm
    To copy to clipboard, switch view to plain text mode 

    How should I deploy the dll in order to make my project viable on a production environnement, without touching the Microstation installation folders?
    I tried to follow the answer posted here by adding the -platformpluginpath in the argv plus the platforms folder's path, but this doesn't work anymore.

    Thank you by advance for your answers
    Last edited by Aria-dvp; 5th August 2020 at 10:25.

  2. #2
    Join Date
    Aug 2020
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Deploying a QApplication inside a DLL -> platform plugin not found even if here

    The solution was simple, thanks to hskoglund on this thread [link]. Here the quote :
    [...] add the path to the Qt files yourself via some C++ code, this has to be done before QApplication's constructor (because that's where the plugin loading occurs), say like this:
    Qt Code:
    1. ...
    2. QCoreApplication::addLibraryPath("C:/Project folder");
    3. QApplication a(argc,argv);
    4. ...
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to Aria-dvp for this useful post:

    d_stranz (5th August 2020)

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,235
    Thanks
    303
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Deploying a QApplication inside a DLL -> platform plugin not found even if here

    Can you supply any details about how you managed to get QApplication running in a DLL? A lot of people have tried this, and as far as I know you are the first to report success. It would be great if we could have a general recipe for encapsulating Qt in a DLL that runs in a non-Qt application.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #4
    Join Date
    Aug 2020
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Talking Re: Deploying a QApplication inside a DLL -> platform plugin not found even if here

    Quote Originally Posted by d_stranz View Post
    Can you supply any details about how you managed to get QApplication running in a DLL? A lot of people have tried this, and as far as I know you are the first to report success. It would be great if we could have a general recipe for encapsulating Qt in a DLL that runs in a non-Qt application.
    Hi d_stranz !

    I didn't know at all that I was the first one. Yes I can do this, I'm thinking about doing a blog article in order to share this experience, I would be glad to help.
    I'll be back here to share the link when it'll be done.

Similar Threads

  1. Platform plugin for blackberry not found?
    By Clever&Smart in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 21st July 2015, 12:40
  2. Problem Deploying Qt5 Application to a Windows 8 platform
    By davethomaspilot in forum Installation and Deployment
    Replies: 3
    Last Post: 20th February 2015, 22:36
  3. QApplication not found using qmake win64
    By vyalmicro in forum Installation and Deployment
    Replies: 3
    Last Post: 22nd October 2014, 15:55
  4. Deploying a hello world program on windows:Entry Point Not Found
    By thefatladysingsopera in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2011, 19:32
  5. QApplication & QPushButton not found
    By briahn06 in forum Installation and Deployment
    Replies: 3
    Last Post: 9th April 2006, 17:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.