I create empty C++ project in QT Creator using cmake. After some menus where I choose "cmake" as a building tool I see a project hierarchy:
- MyTestCMake2
- CMakeLists.txt
(New Project -> Non-Qt Project -> Plain C++ Application -> checked CMake for building system)
And that's all! It's strange but QTCreator opens main.cpp with some C++ code but QTCreator tells me that this file does not a part of my project. I try to add main.cpp manually to MyTestCMake2 project but I can't do it. It's disabled.
CMakeLists.txt content is:
cmake_minimum_required(VERSION 2.8)
project(MyTestCMake2)
add_executable(${PROJECT_NAME} "main.cpp")
I try to run cmake with: Build -> Run CMake but nothing happens. What's wrong? Why QTCreator doesn't work with CMake properly?
My env is:
cmake: 3.9.1
Qt Creator: 4.3.1 (Qt: 5.9.1)
Mac OS Sierra 10.12.5
SOLVED
I've upgraded Qt Creator to 4.4 and it worked out of the box! I did the same steps as before but now it works without any problems! What a magic.
I've upgraded Qt Creator to 4.4 and it worked out of the box! I did the same steps as before but now it works without any problems! What a magic.
Sometimes the mixed QT 5.x installation breaks the kits. Several kits starts to show a warning in the kit popup message balloon (Tools->Options->Kits->Kits: Auto-detected/Manual) about unsupported generator cmake server mode (cmake -E command line option).
Seems only behind the cmake server mode the Qt Creator can properly build the Projects pane.
The only way I could get it fixed is complete QT uninstall before install. Even the last QT 5.x minor version can break the kits (5.12.12 at the moment).
Related
I'm having a project in Qt Creator and I'm trying to port it into CLion but I found myself blocked into some problems. If any of you could help me to port this CMake project I would really appreciate it.
Qt Creator
So, here is my setup for the Qt Creator project first:
Qt: 5.14.2
Compiler: MSVC 2017 64-bits
Also, here are my custom paths and my build environment:
Also, the build (install) time in Qt Creator takes around 20-30minutes.
CLion
Now in terms of CLion and what I've tried here are the following.
and in terms of setting up the CMake:
I've also added the paths into Environment Variables from CLion
But the problem arises when I'm trying to compile the project.
I'm going to install the project via Build -> Install
After that, I need to wait for around 1h or more(even if in Qt Creator is going to take just 20-30min) to a point where the build will fail and I will receive the following error message
MASM : fatal error A1000: cannot open file : 4 [C:\PRJOJECT_NAME\build_clion\components\extern_crashpad\crashpad\util\crashpad_util.vcxproj]
but if I'm searching for that file, it exists in that folder which is specified. But the problem is that I don't understand why the same project if build with Qt Creator is working but not vice versa. Could any of you help me to understand what I'm doing wrong?
It looks like QT Creator is using Ninja as a generator and CLion is using MSVC.
Try -G Ninja in your CLion CMake Options text box. Make sure Ninja is in a path accessible by CMake.
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).
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.
faced with an issue during qt creator using (re-build action):
Running steps for project algolist... Could not start process "" clean
Error while building/deploying project algolist (kit: MSVC2015)
Environment settings:
QtCreator 3.5.1
Windows 10 (and SDK forWin10)
visual c++ compiler with libraries version 19
I do not use any qt libraries in a project, and havew an installed qt kit just for qmake support (qmake is a build tool for my project)
all compiler's settings are manual via INCLUDE/LIB/PATH. and this configuration works on my other machine, can't find a differences and the message above doesn't look informative, could you someone explain me please what this mean ?
thanks
as fas as I use manual compiler configuration , I had to specify nmake path there as well. so this fix in compiler config fixed my problem
sorry for my inattention
I want to compile the qwt library using qt 5.3. Previously I had older versions of Qt. So, when I call the Qt 5.3.0 32-bit for Desktop (MSVC 2012 OpenGL) shell and move to the directory, which contains qwt (C:\qwt-6.1.0), then perform qmake qwt.pro I get this error:
Cannot read c:/Qt/Qt5.0.2/mkspecs/win32-msvc2010/qmake.conf: The system cannot find
the path specified. Could not read qmake configuration
file c:/Qt/Qt5.0.2/mkspecs/win32-msvc2010/qmake.conf.
Error processing project file: C:\qwt-6.1.0\qwt.pro
Calling:
qmake -set QMAKESPEC "C:\Qt_5.3\5.3\msvc2012_opengl\mkspecs\win32-msvc2012\"
Does not help.
PS. Solution is found! I've tried not to do like is in qwt tutorial, simple open *.pro file by Qt Creator. After this just "build" and everything was done. Without console