Qt Doesn't compile anything on mac - c++

hey guys I just updated my mac to monterey 12.1 and then my qt creator doesn't compile anything any part of code no deference non console app or non widget app or any other types and just telling me the same error:
:-1: error: No rule to make target `untitled6'. Stop.
:-1: warning: "/.../.../CommandLineTools/usr/bin/clang" is used by qmake, but
"/usr/bin/clang" is configured in the kit.
Please update your kit (Replacement for "Qt 6.2.0 for macOS") or choose a mkspec
for qmake that matches your target environment better.
:-1: warning: "/.../.../CommandLineTools/usr/bin/clang++" is used by qmake,
but "/usr/bin/clang++" is configured in the kit.
Please update your kit (Replacement for "Qt 6.2.0 for macOS") or choose a mkspec
for qmake that matches your target environment better.
I try to build new projects and new codes and check my paths and also uninstall and install again the qt but non of them worked and it gave me the same error. I had read the errors but I can't figure out what should I do with my kits!
this is my confige page:
What should I do?

Manually delete the hidden folder .qmake.stash in your build folder from the terminal
Run qmake from Qt Creator
Build as normal
(A manual make distcleanin the build directory should also fix it, but I never tried that)

Related

Qt cannot load cocoa plugin

I'm trying to compile and run an application on a MacBook using Qt Creator. There are no issues compiling the project, but when I try and run it, it seems to be unable to load a plugin.
Could not load the Qt platform plugin "cocoa" in "" even though it was found.
The application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
This error occurs both when trying to run the application from Qt Creator or via Finder. It seems to only happen when I use the CMake build system (no issues when using QMake), but my existing project that I need to deploy on MacOS uses CMake.
My steps to reproduce are:
Install a completely clean MacOS (no user data)
Install Xcode 11
Install CMake 3.15
Install Qt 5.13.1 MacOS package
Open QtCreator->New Project->Qt Quick Application - Scroll
Set build system to CMake (important)
Compile and notice error
I am using:
Qt 5.13.1
macOS Catalina 10.15
Apple Clang 11
I recognize that for final user deployment I will need to use the macqtdeploy tool to copy the Qt libraries to the executable folder, but I should be able to run my app from QtCreator without doing this? Especially as it works fine when using QMake.
So it ended up being some kind of name resolution thing where Qt Creator couldn't decide whether to use the debug or release versions of the framework. Supplying DYLD_IMAGE_SUFFIX=_debug fixed this (add this to the environment section under Kits).

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

Why my QtRPT project file is not running in QtCreator?

I have QtRPTProject to run in the QtCreator but It is showing errors like " Cannot run compiler 'g++'. Maybe you forgot to setup the environment?" and "Project ERROR: Unknown module(s) in QT: script" while building.Any help ??
Project ERROR: Unknown module(s) in QT: script
This means that the module Qt Script is not installed.
This module has been deprecated and is not installed by default, you have to opt-in.
The exact procedure on how to install it depends on how you installed Qt in the first place. If you used the online installer, it is just a matter of running the "Maintenance Tool" and checking the Qt Script checkbox.
Cannot run compiler 'g++'. Maybe you forgot to setup the environment?
This means that Qt Creator cannot find the c++ compiler.
That means that you have not installed a compiler, or not configured Qt Creator correctly.
Again the exact procedure depends on your system and which compiler you want to use. If you are on Windows, the Qt Maintenance Tool offers to install MinGW for your. Like for Qt Script it is just a matter of checking the right checkbox. Be sure to select the MinGW version that matches the version of Qt you selected.
If you need more help, please edit your question and add details about your system and your current installation.

how to specify search directory for source code build

I am trying to install Jom (http://wiki.qt.io/Jom) for C++. When I type in qmake -r in cmd, I get the error Project MESSAGE: Cannot build jom with Qt version 4.8.7. Project ERROR: Use at least Qt 5.2.0.. This is because I have PyQt version 4.8.7 and Qt version 5.8.0 both installed. When building Jom, Jom searches for in the wrong Qt folder. How can I fix this?
If you have multiple version of Qt installed, you also have multiple version of qmake. You can check which qmake you are running by using where qmake on Windows, it will output a list of qmake executable available in your path, the first one in the list will be the one executed when running qmake.
For instance:
C:\>where qmake
C:\Qt\5.8\msvc2015\bin\qmake.exe
C:\Qt\5.6\msvc2015\bin\qmake.exe
If the first one, is not the one you want, you can run it by using its complete path:
C:\>C:\Qt\5.6\msvc2015\bin\qmake.exe -version
QMake version 3.0
Using Qt version 5.6.2 in C:/Qt/5.6/msvc2015/lib
If the qmake and Qt version you want is not in your PATH, you can use the scripts provided by Qt to setup a valid environment. These are available in the Start menu as Qt 5.8 64-bit for Desktop (MSVC 2015) (change according to your installation), or you can use them directly by executing qtenv2.bat (e.g C:\Qt\5.8\msvc2015\bin\qtenv2.bat).
If you are using MinGW you are all set, but if you are using MSVC you need also to run vcvarsall.bat, which can be found in your Visual installation folder.

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.