Configure error with Qt, MinGW, CMake: Qt version not found - qt

I have a problem building an application from Qt Creator; from the configure step, I get this error:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1382 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
CMakeLists.txt:13 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
If I configure it from the command line, everything is file:
cmake -G "MinGW Makefiles" ..\ProjectDir
In the paths environment variable Qt is present (src, bin and lib paths).
Platform:
Windows 7
MinGW/GCC 4.4
CMake 2.8.11
Qt 4.8.5
Qt Creator 2.8.1

When you want to develop a CMake based project with Qt Creator, you should not execute CMake manually before. Qt Creator generates a Code::Blocks project from your source to work with CMake, so if you generate with -G "MinGW Makefiles" it will not work.
Instead, you could try the following steps:
In Qt Creator, Open Project > Select the top level CMakeLists.txt
Set a build directory somewhere close to the CMakeLists.txt or in its parent folder, then click on Next
Select your generator (Combination of a Qt version and a compiler)
[optional] set some CMake arguments
Click on Execute CMake, then Finish
Your project should now be opened in Qt Creator and ready for development

Related

Error: The deployment target requir Qt libs, but init qmake is failed. (CQtDeployer)

i am try to use CQtDeployer.
I am using ubuntu 18.04 and QT 5.9.5.
I want to run this on terminal:
cqtdeployer -bin MY_APP_NAME_IN_RELEASE_FOLDER -qmake /usr/lib/qt5/bin/qmake
Note:
/usr/lib/qt5/bin/qmake -> FROM QT CREATOR -> options -> qt versions -> autodetected qt 5.9.5 -> qmake locations
Result:
Info: Deploy ...
Info: flag targetDir not used. use default target dir :/root/Masaüstü/RELEASE/DistributionKit
Error: The deployment target requir Qt libs, but init qmake is failed.
Error: deploy is failed!
Note2:
root#ubuntu-pc:~/DEPLOY_TEST_1# qmake --version
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
What's the problem?
And the solution:
Blockquote
Solution 1
As a workaround, uninstall the snap version of cqtdeployer and install cqtdeployer from the installer.
Solution 2
Install Qt from an official source in user space.
If you are unable to use the GUI, use the console utility to install Qt
Blockquote
Solution from : https://github.com/QuasarApp/CQtDeployer/issues/373#issuecomment-637762214

Build Project with QtSerialPort

I want to build a project wich is using QtSerialPort. I'm using Qt 5.2.1 and Ubuntu 14.04.2 LTS. So, I have not to download QtSerialPort (?) See the news from 2013-07-03 here.
I'm creating a Makefile with cmake, which works. If I execute make, I got this error:
fatal error: private/qringbuffer_p.h: No such file or directory.
I have no idea what I have to do. Maybe it is a problem between Qt4 and Qt5?
If I clone the mirror as described here under Gettig the source code I can't execute the command
git checkout qt5.2.1

Problems with Qt 4.8.5 and MinGW/GCC 4.8.1

I just made a clean install of the following tools on Windows 7:
MinGW / GCC 4.8.1
Qt 4.8.5
Qt Creator 2.8.1
In the PATH there is: C:\Qt\4.8.5\bin;C:\Qt\4.8.5\include;C:\Qt\4.8.5\lib;C:\MinGW\bin;
1) I read the warning about the fact that Qt 4.8 needs GCC 4.6. I ignored it, using GCC 4.8.1. So this could be an issue.
2) I successfully installed Qt Creator. I successfully built the default Qt GUI application. When launched I get the error: "The program has unexpectedly finished." Debugging I get a segmentation fault before entering main(), in the qatomic_i386.h file, in the QBasicAtomicInt::deref() member function.
If I build a cmake based console application, everything is fine.
3) If I build a previous Qt cmake based project (either from the command line or from Qt Creator), this is what I get (out of tree build):
The first time I run cmake:
MyPrj-build>cmake -G "MinGW Makefiles" ..\MyPrj
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:20 (message):
sh.exe was found in your PATH, here:
C:/Program Files (x86)/Git/bin/sh.exe
For MinGW make to work correctly sh.exe must NOT be in your path.
Run cmake from a shell that does not have sh.exe in your PATH.
If you want to use a UNIX shell, then use MSYS Makefiles.
Call Stack (most recent call first):
CMakeLists.txt:6 (PROJECT)
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:S:/MyPrj/MyPrj-build/CMakeFiles/2.8.11.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:S:/MyPrj/MyPrj-build/CMakeFiles/2.8.11.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
The second time:
S:\MyPrj\MyPrj-build>cmake -G "MinGW Makefiles" ..\MyPrj
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1382 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
CMakeLists.txt:12 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
Is it normal to have these different behaviours in the first and second cmake run?
Why cannot the system find Qt4?
Are these three issues dependent on each other?
How did you "install" your Qt? The only way of "installing" it in your case is to build it from the sources. Generally, you need to use the same compiler to compile Qt as you use to compile your Qt-using project. Some C++ compiler version mismatches might work, but you've just shown that your combination doesn't.

Qt 4.8 compiling from ubuntu to windows

I have a simple app that I can compile on the desktop for Ubuntu 12.04, but not for Windows. I installed the MinGW toolchain, both from synaptic, and the QT 64-bit package from here.
I went to Tools-->Options-->Build, and manually added both the /usr/bin/i686-w64-mingw32-g++, as well as the g++.exe from the link above (in the bin folder) as MANUAL_1 and MANUAL_2.
When I go to create a custom target however I am unable to select either Manual toolchain and it reverts back the standard GCC x86_64 linux.
What am I doing wrong?
I doubted the g++.exe file would work since that is a windows binary, but why does it not select the system mingw binaries?
Few things you should check
Your gcc version number
Is your gcc path added to environmental variable?
I too found it very difficult to compile my MINGW Qt application in Windows, and after lot of research on net I found that qt4 works with gcc 4.4.0 MINGW. I downloaded qtcreator 2.1 from qt website and copy MINGW folder from qtcreator directory, copy that folder into my windows root directory then installed latest qt creator and qt4 sdk,
Add path of gcc
and finally qt creator compiles my code.

Qt error cannot find -lQtCored collect2: ld returned 1 exit status

I am getting the following error, when I run programs in debug mode.
cannot find -lQtCored
collect2: ld returned 1 exit status
I can run programs normally in release mode. Is it because I have done static linking (I can run my executable without Qt Creator)?
I am using Qt Creator with Qt 4.7.0 on Windows.
The following command would solve this issue:
sudo apt-get install libglu1-mesa-dev
Your linker can not see debug library of QtCore (as shown - -lQtCored, release lib - -lQtCore).
You need checked, really you build this debug library or not, then checked all pathes to this debug library.
PS. Yes, you can run executable without Qt-Creator. You should use qmake (into directory with your .pro) and make (when your qmake has generate Makefile).
PSS. If you want to run .exe then you should put some Qt libraries into directory with .exe.

Resources