I am setting up Qt using CLion and build project successfully.
But the problem comes when I try to run it, which it does not run because it can't find the Qt Library.
When using QtCreator, I don't need to setup anything to run Qt project (it does automatically). So, how QtCreator run the project? So I can achieve it on CLion?
Already set PATH to Qt bin, but it does not work.
Related
How to use Qt with Visual Studio Code? I have Qt 5.15.1 installed which builds my code for macOS, Android and iOS.
Is it possible to have Visual Studio Code build my Qt application for macOS, Android and iOS like QtCreator does?
Environment:
My developer environment is macOS Catalina.
If you're using cmake, which you should, then all you need to do is configure your cmake project to point to your Qt folder, which basically means setting the project's Qt5_dir env variable to point to your Qt installation.
Here's what you need to do to get Visual Studio Code to work with Qt using Microsoft's CMake Tools extension:
Verify that you really have Qt installed,
Install Microsoft's CMake Tools extension,
Open CMake Tools extension's "Edit CMake Cache (UI)"
click on "CMake extension" on vscode's activity bar to open "CMake: project outline",
click on the "View and more actions" button (i.e., elipsis on upper right corner of the project outline.
Edit CMake's cache to point Qt5_dir to ${QTINSTALLDIR}/5.15.1/gcc_64/lib/cmake/Qt5
Rebuild project.
You can achieve the same goal by using cmake-gui to configure your cmake project.
If instead you really want to stick with qmake then it's enough to setup a build task that runs qmake.
MMMMMM#unbuntu:~/QT/test4Qml$ qmlscene main.qml
qmlscene: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmlscene': No such file or directory
My Qt Development Environment does not have qmlscene. I googled it, and I only found *.deb. How should I do it?
As far as I know, Qt is not installed by default in /usr/lib/x86_64-linux-gnu/qt4. That directory is the default path when linux detects a dependency which requires Qt.
Where did you installed Qt? How did you installed it? Did you set the PATH environment variable to where Qt binaries are installed?
Usually, you have to follow the next steps:
1.- Install the the basic requirements for building Qt applications.
2.- Download Qt. I recommend Qt 5 using an offline installer. Otherwise, you'd need to compile from the source. Here you have a list of older versions of Qt.
3.- Set the environment variable PATH to the directory where you Qt bin directory is installed.
I am trying to build an QT application with version 5.4.
and when ever I am trying to run the exe on a different machine where QT is not installed I am getting below error "The program cannot start because QT5core.dll is missing from your computer, Try reinstalling the program to fix this problem".
and when I copied QT5core.dll with the exe in a machine where QT is not installed its working fine.
Is there any way that I can link QT5core.dll with the exe statically so that whatever place I run this exe it should not ask for any dll.
Thanks,
Tushar
You can build a standalone version of your Qt application so that it doesn't have any library dependencies at runtime. Be warned though: this can greatly expand the size of the .exe generated and the compilation time. Have a look here:
https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows
and here:
https://wiki.qt.io/How_to_build_a_static_Qt_version_for_Windows_with_gcc
I'm trying to import my Cmake project in QtCreator, which I'd want to use as code editor, but with completition for Qt classes an the possibility to do the build via Ctrl+R
When importing the Cmake project, the QtCreator ide hangs when running CMakeWizard when I try to select RunCmake. If I cancel an empty windows pops up and the project is not generated.
Is it possible to import an existing cmake project in QtCreator?
Ubuntu 10.10 x86_64, QtCreator 2.6
Normally you just do "Open Project" and then select the CMakeLists.txt as the project file. QtCreator will then ask you to run CMake once (to generate a CodeBlocks build file, which is then interpreted by QtCreator). After that you have native support for your CMake project.
It even works with rather complicated CMake scripts.
If you observe hangs etc., you should probably file a bug report with the QtCreator project.
I had a similar issue when qtcreator crashed when opening cmake projects created in older versions of qtcreator. Removing CMakeLists.txt.user and running qt from terminal resolved issue for me.
cd /path/to/project/
qtcreator .
I have just purchased a Macbook (yes I am a complete noob on Mac though I have some considerable experience with Linux) and I'm trying to build my Qt application on it. I have installed XCode and the Qt SDK but when I try to build my project on Qt Creator all I get is the following error during qmake:
Running build steps for project TimeTracker...
Starting: "/usr/bin/qmake" /Users/raphaelcruzeiro/Documents/Projects/Timely/Widget/TimeTracker/TimeTracker.pro -r -spec macx-g++
Failure to open file: /Developer/Applications/Qt/Makefile
Unable to generate makefile for: /Users/raphaelcruzeiro/Documents/Projects/Timely/Widget/TimeTracker/TimeTracker.pro
The process "/usr/bin/qmake" exited with code %2.
Error while building project TimeTracker (target: Desktop)
When executing build step 'qmake'
Any ideas on what is going on? /Developer/Applications/Qt/Makefile indeed does not exist.
EDIT:
Ok, I know what is going on but I don't know how to fix it. When I ran qmake from the terminal everything went just fine. I believe that Qt Creator is trying to build my application on the Qt directory itself and it does nt have permission for it (it shouldn't anyway).
How do I tell Qt Creator where to build my application? I didn't find it anywhere and setting the DESTDIR variable isn't helping.
THE SOLUTION:
Deleting the .pro.user file made Qt Creator build the application to the directory specified in DESTDIR
THE SOLUTION:
Deleting the .pro.user file made Qt Creator build the application to the directory specified in DESTDIR
I was battling with the same thing. What helped eventually was resetting the default build directory here: