Qt on VS 2017: Link DLLs at Runtime



  • Hello everyone,

    I just started using Qt on VS today and I am running into a small issue.
    I can build my solution with no problems, both in Debug and Release mode 64-bit, but when I try to run it I get run time errors.
    The errors are all related about not finding DLL files at run time such as Qt5Widgets.dll and Qt5Core.dll.

    How can I fix this issue properly? I have done some research and people suggest to copy these DLL files in the folder of where the .exe is created. Are there any other approaches I can use? For example changing some settings in the projects?

    Thank you everyone for your help and tips.

    Bests,
    Rosario



  • Hi @alexCali
    This type of question already discussed and solved
    Please refer Executable Creation



  • Thank you for your reply however I don't think that solves my issue.
    I need to be able to run my application from within Visual Studio.
    So, when I press F5 on Visual Studio I need to be able to debug my application.

    Any hints on how to do it on Visual Studio and not on Qt Creator?



  • I use Qt 5.9.3 with VS2017 on win7, 64bit.
    My app is compiled as 32bit.

    I create a .vcxproj file via qmake from my .pro file.
    VS2017 is started about a .bat containing following:

    @echo off
    echo **********************************************************
    echo ** Setting up environment VS2017 for Qt 5.9.3 (x86) usage 
    echo **********************************************************
    echo ...
    call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Professional\VC\Auxiliary\Build\vcvars32.bat
    devenv /useenv
    

    Additionally I have set the environment variable QTDIR=C:\Qt\Qt5.9.3\5.9.3\msvc2015 and add it to PATH=%QTDIR%\bin;%PATH%

    This allows me to start any Qt 5.9.3 based app from anywhere on my computer.

    Cheers



  • This post is deleted!


  • @jackmack Are you also able to debug your Qt Application using VS 2017 and its Debugger?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.