[Resolved] Qt 5.0.0 Building projects, *.exe always ask for Qt5Cored.dll and other components when launching



  • Hello there guys I was just wondering if someone could give me a hand on this... I'm doing few tutorials on web and I have been compiling/building projects for a while now.. But something that has been cracking me is that every time I would like... let's say, Move the *.exe file that is located within the project directory out of it, for example to the Desktop, when I run it, it says always (This error shows up for every single file I compile/build/excecute:

    !http://i.imgur.com/9bdEq.png(Error ScreenShot)!

    And I don't know how to resolve it by myself... I know this could be some associations with libraries not being recognized or something by the linker could it be? Or is it a library I need to add by myself? if that's so.. How could I fix it to not manually add it.. I mean let the linker/builder, build everything withing the *.exe.

    Thanks for your cooperation guys and hope someone shed light on me.



  • add your qt (eg:C:\QtSDK\Qt5\5.0.0\msvc2010\bin) to your environment PATH



  • How could I do so? I tried adding that path (my working path: C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin) into System Variables (Environment) then I try to re-run the program and it says a new error... same error but with different library... now it is: Qt5Widgetsd.dll (Now I'm trying to build a QtDialog Window)

    Is there any other possible fix for this problem?

    EDIT
    I tried running the previous program which had the original problem the helloworld.exe program and it still showing up the error..



  • [quote author="AxDSan" date="1357067470"]I tried adding that path (my working path: C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin) into System Variables (Environment)[/quote]
    What actually did you do?

    [quote author="AxDSan" date="1357067470"]How could I do so?[/quote]
    You should:

    Go to Start menu -> Programs -> Standard -> Run

    Type systempropertiesadvanced and press Enter

    Press Environment variables button (or something like this, I don't have English version of Windows)

    Press Create or Add button.

    Create new variable with name QTDIR and value C:\Qt\Qt5.0.0\5.0.0\msvc2010\

    Find PATH variable, choose it and press Edit button.

    Add @;%QTDIR%/bin@ at the end of the edit line (don't delete the value you already have there).

    Press OK everywhere.

    Now everything should work. If it doesn't, check, if there are libraries with suffix "d" in C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin. If not, then just find them in your Qt dir and add the dir, that contains them in your PATH with instructions, provided above. Just give another name to variable, for example, QTDIR_DEBUG.

    EDIT:
    I've made a mistake in what you should add in the end of PATH variable.



  • Thanks Both @itviewer & @Wilk Both Answers were pleasant with full of information.

    I followed both instructions and did well...

    Now I tweaked settings by my own as well, If someone happens to be struggling with the same problem let me add I'm working on Windows 7-64x what I did was very simple...

    Add the following lines into System Environment PATH Variable just like @Wilk stated:

    • Created a New System Variable with Variable NAME QTDIR and with Variable VALUE:
      C:\Qt\Qt5.0.0\5.0.0\msvc2010\

    • Edited Default PATH System Environment Variable and added the following at the end of the line:
      ;QTDIR\bin;C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin;C:\Qt\Qt5.0.0\5.0.0\msvc2010\lib

    Notice the last two objects in bold were added manually by me.. I think this is what resolved the whole situation down here.

    This last tweaks completely resolved my problem.

    Thanks both for sharing information and kindly helping me! Blessings to both of you.



  • Shame upon me. I've found out that I've made a little mistake (I've edited the original post). Sorry me please.
    Also, the objects you've added:

    the first object (C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin) is the same as @%QTDIR%/bin@

    the second object (C:\Qt\Qt5.0.0\5.0.0\msvc2010\lib) is the same as @%QTDIR%/lib@



  • Hey,

    I have exactly the same problem. However, I don't want to resolve it by using dlls. Is it possible to instead statically link everything so that all dependencies are linked in to begin with?

    Thanks,



  • [quote author="Geometrian" date="1357497246"]Hey,

    I have exactly the same problem. However, I don't want to resolve it by using dlls. Is it possible to instead statically link everything so that all dependencies are linked in to begin with?

    Thanks,[/quote]

    Hello there! Geometrian,

    Indeed I happened to be in the same tracks as you could see, and yes you can build Qt statically so you can embed those libraries in the executable so when you deploy your exe you just need to give the standalone executable, So yeah you can find more information on how Static Compile Qt "here":http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows

    As the steps requires you first need to have your mkspecs configured.. like so describes "here":http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows_with_MinGW

    After that keep following instructions on the first link I sent you. Hope you find it useful.

    Special Note: Another good source of Static Building Qt is "This Source":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc but the only thing is that it uses MinGW with GCC 4.4



  • [quote author="AxDSan" date="1357498338"]Indeed I happened to be in the same tracks as you could see, and yes you can build Qt statically so you can embed those libraries in the executable so when you deploy your exe you just need to give the standalone executable, So yeah you can find more information on how Static Compile Qt "here":http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows[/quote]I followed the directions here, and after some modifications, I was able to get the thing built in static mode. There are some problems using it, but I think that's left for another thread.

    For people of the future, my complete documentation on making a successful build for both x86 and x86-64 with or without static compilation may be found "here":http://www.geometrian.com/programming/tutorials/setup_Qt.txt.

    Thanks!



  • Thanx Wilk. I have also faced this problem and solved by your solution.



  • I understand the solution of problem. (I am facing it too) but if this is the solution then it means all apps that we create from Qt can only be run on PCs with this modification. Let say, if I build an app and want to give it to my friends so that thy can also enjoy or I upload it to internet so others can use my app then they wont be able to do so due to this error. Then it will not be for public use. Isn't there any other solution of this prob?



  • I understand the solution of problem. (I am facing it too) but if this is the solution then it means all apps that we create from Qt can only be run on PCs with this modification. Let say, if I build an app and want to give it to my friends so that thy can also enjoy or I upload it to internet so others can use my app then they wont be able to do so due to this error. Then it will not be for public use. Isn't there any other solution of this prob?



  • Hi,

    Thanks for your answers but all your solution concern the issue when the compiler is msvc. I am using a minGW compiler and I am facing the error
    "can't find qt5Cored.dll."

    What should I do now?



  • Hi,

    Thanks for your answers but all your solution concern the issue when the compiler is msvc. I am using a minGW compiler and I am facing the error
    "can't find qt5Cored.dll."

    What should I do now?



  • You don't have to add qt install dir to your environment variable !
    The only thing you have to do is to copy all the necessary dlls into your build dir.

    Look at this thread :
    https://qt-project.org/forums/viewthread/52630/

    I've explained what to do.



  • You don't have to add qt install dir to your environment variable !
    The only thing you have to do is to copy all the necessary dlls into your build dir.

    Look at this thread :
    https://qt-project.org/forums/viewthread/52630/

    I've explained what to do.



  • And what if I don't want to copy all the dlls ?
    Is there another way to specify the dll location only to my program ?


Log in to reply
 

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