Qt visual studio building - c++

I have ms visual studio solution with qt project. When I working from visual studio all works fine. When I try to run *.exe file from building folder I see message that say Qt5Guid.dll(and other dll's) is not found.
What settings need to be changed that QT dll's moves to general building folder ?

You can find in Qt installation dir application windeployqt.
Run it like this:
windeployqt --debug <path-to-app-binary>
It will deploy all needed Qt files to your application's folder. You can read more about deploying here: https://doc.qt.io/qt-5/windows-deployment.html
Also you can try to add directory of Qt to PATH variable
(Thanks king_nak and drescherjm)

Related

exe file is not running in Release folder

My project IDE: Visual Studio 2019, Qt 5.15.0.
I'm trying to launch the application by the project_name.exe file of the release build, but nothing happens.
The project_name.exe file of Debug mode is running well.
The project is running well also in IDE in both Debug and Release modes.
I added Qt Bin directory to the PATH.
I tried windeployqt command but it didn't help.
I copied to Release folder all the dll files the application depends on, according to the build output and Dependencies tool, but then I couldn't run it neither from the exe file nor from the IDE (there are no any compilation errors or error messages when I'm trying to run it).
What is missing for running the exe file from Release folder?
The following steps finally solved my problem:
Copy the qml folder from the project directory into Release folder (it has to be
near the exe file).
In Release folder launch Command prompt and write: windeployqt project_name.exe,
this step must come after having qml files for getting the whole needed deployment
files by windeployqt command.
Copy from your system the following dlls into Release folder: opengl32.dll,
libcrypto-1_1-x64.dll.
For a VM with no Visual Studio installed there are some more dlls to copy.

How to deploy a qt based app(developed on Mac) to Windows?

I developed a desktop Qt app on macOs. I want to execute my app on windows. I've looked that pages:
https://doc.qt.io/qt-5.9/osx-deployment.html
https://godhc.wordpress.com/2012/06/10/build-your-qt-project-on-windows-and-mac-osx/
But it did not make sense well.
Can someone explain me how to do that?
you have to recompile it on windows. you have to make sure your code doesn't use macos "framworks" or unix or linux specific functions.
i recommend downloading a precompiled static QT as building it is impossible. you can get that here and using the visual studio compiler, you will have to download visual studio and all the c++ addons and stuff.
!! edit what ever directory your cmd is in is the output of the qmake !!
you then open up cmd and run the static compiled QT's qmake on the .pro file of your project. e.g.
E:\QT_projects\QT\qt5-5.7.1-vs2015\qt5-x86-static-release\bin\qmake.exe E:\QT_projects\variable-length-string-editor-for-binaries\StringEditer.pro
that will make the makefile. and then open the visual studio cmd called "Developer Command Prompt for VS 2017" for me opening the start menu and typing it in will show it.
you then navigate to the folder where the make files that qmake generated e.g.
cd E:\QT_projects\variable-length-string-editor-for-binaries
then run nmake on release or debug or just nmake e.g.
nmake release

MSVC2013 - Entry Point Not Found

I recently installed the Qt add-inn for visual studio 2013. When I build a project in either Qt Creator or Visual Studio using MSVC2013 it builds without errors, but can only be run from inside the IDE. If I try to run it by clicking the .exe, it gives an error: "The procedure entry point ?qt_metacast#QMenuBar##UAEPAXPBD#Z could not be located in the dynamic link library".
From the research I have done online, I found that it could be something to do about adding the correct .dll files in my .exe directory. Which .dll files do I need or is there something else I'm doing wrong?
I installed the Visual Studio Add-in 1.2.4 for Qt5 from the Qt website.
DLLs for this kind of libraries use to be unnecessarily big. You should make a Qt static compilation so that your needed functions are embed into your *.exe.

How can I run qwt examples using Visual Studio 2010?

I'm trying to run Qwt examples using VS2010. I've installed the Qt plugin for Visual Studio. I then open the .pro file of Qwt and the build succeeds. But I have no clue what to do next. Whenever I click run, it gives me a dialog which says
unable to start programe E:\qwt-6.0.1\src..\lib\qwtd.dll
Does anyone have an idea what might cause this?
I just managed to get the examples compiled using the command line tools. Key steps included:
Add the bin dir of qt and the lib dirs of qt and qwt to the path
Dont forget to run vcvars32.bat from Visual Studios bin directory
VC\bin should be in the path too
then follow the INSTALL instructions from qwt
After this I had a set of running examples in examples/bin of qwt. It's also easy to open one of them in Developer Studio with the "Open Qt Project File" option in the Qt Menu.
From the information you're giving us, it seems you have the project generating your DLL set at the StartUp project. So whenever you click on run/debug, it will try to run the output of that project, in this case a DLL. Of course this won't work.
If there is a project for the example you want to run, right click on that project within the Solution Explorer and select "Set as StartUp Project". Now when you click on run/debug, it will run the output (the executable) of the project you selected.

How to build exe in Visual Studio C++

I am a .NET C# developer and trying to learn C++.
I am having issues in trying to create an exe from a console app from Microsoft Visual Studio when I do a build compile and check the Debug folder. There isn't any exe, just some manifest files and other files. I am asking this because I am not sure if this is how it works? is there any another way of doing this?
I have tried the Microsoft Visual Studio console and c:\cl test.cpp, this gives me an test.exe but can it be done from the MSVS GUI like in C#?
Have you checked the debug folder at the solution level? I believe this is the default target directory. The DEBUG folder in the project is for the output of temporary build files.
Did it compile successfully ? Also, check your active configuration if its debug or Release ?
Also, check the output path to double check the location of executable.
It works the same as C#, so there is no need for command line.