.exe in Build file not working
-
When I build it with Qt Creator and run it on Qt Creator, the program works without any problems, but when I go to the folder and run it, it does not work because the .dll files are missing. After running windeployqt this time it says different .dll is missing.
What is the reason for this?

-
Step 1.)
If you are using CMake you can do following:
This configures the install command to create a deploy folder in your binary dir in which the deployed application will be placed.# Deploy path set(CMAKE_INSTALL_BINDIR ${CMAKE_BINARY_DIR}/deploy) set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )Step 2.) (either this qml approach or the widget approach)
if you have an qml app:
This adds all the needed qml dependencies needed for your application to run.qt_generate_deploy_qml_app_script( TARGET ${name} OUTPUT_SCRIPT deploy_script ) install(SCRIPT ${deploy_script})Step 2.) (either this widget approach or the qml approach)
if you have a widget app
This adds all the needed widget dependencies needed for your application to run.qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script ) install(SCRIPT ${deploy_script})Step 3.)
Finally, after doing all this you have to tell QtCreator to call the install toolchain to actually install your application.Go to QtCreator -> Project -> Build -> Build Steps.
If you want to let CMake do the installation you can add a cmake build step:

If you use ninja like me you can then add a custom process step:

-
When I build it with Qt Creator and run it on Qt Creator, the program works without any problems, but when I go to the folder and run it, it does not work because the .dll files are missing. After running windeployqt this time it says different .dll is missing.
What is the reason for this?

@serkan_tr please familiarise yourself with this documentation: https://doc.qt.io/qt-6/windows-deployment.html
You are missing deployments steps, your program is missing libraries.
-
Step 1.)
If you are using CMake you can do following:
This configures the install command to create a deploy folder in your binary dir in which the deployed application will be placed.# Deploy path set(CMAKE_INSTALL_BINDIR ${CMAKE_BINARY_DIR}/deploy) set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_BINDIR}) install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )Step 2.) (either this qml approach or the widget approach)
if you have an qml app:
This adds all the needed qml dependencies needed for your application to run.qt_generate_deploy_qml_app_script( TARGET ${name} OUTPUT_SCRIPT deploy_script ) install(SCRIPT ${deploy_script})Step 2.) (either this widget approach or the qml approach)
if you have a widget app
This adds all the needed widget dependencies needed for your application to run.qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script ) install(SCRIPT ${deploy_script})Step 3.)
Finally, after doing all this you have to tell QtCreator to call the install toolchain to actually install your application.Go to QtCreator -> Project -> Build -> Build Steps.
If you want to let CMake do the installation you can add a cmake build step:

If you use ninja like me you can then add a custom process step:

-
S serkan_tr has marked this topic as solved on