QT project error: Unknown module in QT: widget - c++

I installed the Qwt library (osx) and added it to my Qt project. After executing:
qmake -set QMAKEFEATURES ${QWT_ROOT}/features
I got the project build error:
QT project error: Unknown module in QT: widget
I removed the Qwt library from my project and system but the error is still existing. I also tried to reinstall Qt 5.2.1 and removed all user settings but still the same problem. To check if the property is still there I executed:
qmake -query QMAKEFEATURES
which returned:
**Unknown**
therefore this should not be the problem.
The compiler gives the following output:
ASSERT: "fileName.isEmpty() || isAbsolutePath(fileName)" in file /work/build/qt5_workdir/w/s/qtbase/qmake/library/ioutils.cpp, line 61

I found out there is a bug report in QT:
https://bugreports.qt-project.org/browse/QTBUG-29642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
As I entered the command:
qmake -query
without an argument, it output that the property QMAKEFEATURES was still set:
QMAKEFEATURES:/usr/local/qwt-6.1.1-svn/features
Finally invoking:
qmake -unset QMAKEFEATURES
solved the problem.

Related

unrecognized command line option '-Zc:__cplusplus' and unrecognized command line option '-permissive-'

I am trying to run and debug Qt6 widget application in clion.
I tried the things that u would get when do a simple search but no success.
Recently my friend told my to do this :
Add "C:\Qt\Tools\mingw810_64" to toolchain environment like this :
now when I create a Qt widget project like this :
I get these error :
Problems were encountered while collecting compiler information:
g++.exe: error: unrecognized command line option '-Zc:__cplusplus'
g++.exe: error: unrecognized command line option '-permissive-'; did you mean '-fpermissive'?
What should I do now ?
Why doesn't it recognize these options ?
I cannot change g++.exe file (or can I?) What can do about it?
I have been struggling to manage to run and debugg Qt6 project on clion the past few weeks.
God bless anyone who help me to do this.
Please Help!
The problem is that you use MSVC-build of Qt and not the MinGW one. Update your CMakeLists.txt file:
set(CMAKE_PREFIX_PATH $ENV{QTDIR})
the environment variable QTDIR is set to Qt MinGW path (e.g. D:\Qt\6.2.3\mingw_64).
Don't forget to add the corresponding directory bin (%QTDIR%\bin) to the path environment variable.

*** internal error: unable to open jobserver semaphore '3,4': (Error 2: The system cannot find the file specified. ). Stop

I am trying to compile an existing qt application's code using mingw compiler.
During compilation I am getting an error "*** internal error: unable to open jobserver semaphore '3,4': (Error 2: The system cannot find the file specified. ). Stop".
My current project is a makefile based project. Here I have one make file (parent.mk) that compiles all primary modules and then
parent.mk
compilation steps
.
.
.
make $QT_CODE_DIR
Here in this QT code directory I have another makefile (child.mk) which has following content:
child.mk
cd "qtcode_compilation_out_dir"
qmake.exe "product.pro" -r -spec win32-g++
CONFIG+=release
mingw32-make -w
If I try to run the make command manually for QT code then it works fine.
#Alexander: Thanks for the suggestion.
Please suggest if anyone has any idea about it.
Thanks.
Finally, I found out the exact reason of the problem and solution as well.
Reason for failure:
The compilation command that I am using is "make" which is been aliased to "make -j2"and along with "mingw32-make -w" it was producing the error because mingw32-make is an obsolete make command and it doesn't support multi threaded compilation.
Solution:
I just replaced the mingw32-make with make.

Qt Creator project using CMake : Issues removing files

So here's a quick (and probably inane) question from someone new to CMake and Qt.
I'm currently using Qt Creator, alongside of CMake, to create some project. I have 2 C++ files that I have to remove that are no longer used anywhere within the codebase. I have removed them from the project, the CMakeLists.txt file, nuked the build and qt_build directories, and proceeded to try to rebuild. However, I seem to be getting an warning when running qmake which looks like this...
15:03:03: Running steps for project Traveler...
15:03:03: Starting: "C:\Qt\5.9.2\msvc2017_64\bin\qmake.exe" C:\Users\someone\Traveler\Traveler.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"**
Info: creating stash file C:\...\build-traveler-Desktop_Qt_5_9_2_MSVC2017_64bit-Debug\.qmake.stash
WARNING: Failure to find: src\XX_Exceptions.cpp
WARNING: Failure to find: include\XX_Exceptions.hpp
WARNING: Failure to find: src\XX_Exceptions.cpp
WARNING: Failure to find: include\XX_Exceptions.hpp
15:03:07: The process "C:\Qt\5.9.2\msvc2017_64\bin\qmake.exe" exited normally.
15:03:07: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" qmake_all
It seems as if qmake exits without error, but I really don't like seeing these compiler warnings (especially duplicated, so its showing up in two places).
Then, when I proceed to try to build...
15:16:27: Running steps for project Traveler...
15:16:27: Configuration unchanged, skipping qmake step.
15:16:27: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe"
C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
Error: dependent 'src\XX_Exceptions.cpp' does not exist.
jom: C:\Users\someone\build-Traveler-Desktop_Qt_5_9_2_MSVC2017_64bit-Debug\Makefile [debug] Error 2
15:16:28: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project Traveler (kit: Desktop Qt 5.9.2 MSVC2017 64bit)
The kit Desktop Qt 5.9.2 MSVC2017 64bit has configuration issues which might be the root cause for this problem.
When executing step "Make"
Question :: Is there any location where the specific files in the project are referenced besides the CMakeLists after I nuke the build directories?

When compiling get error: 'QtGui/QAction' file not found #include <QtGui/QAction>

I just installed Mac OS X 10.8.3 and Qt Creator 3, XCode, and XCode command line tools. I'm trying to compile a project that works on another computer but each time I go to "build all" I get error: 'QtGui/QAction' file not found
in #include <QtGui/QAction>
I tried adding the second and third line in the .pro file but it didn't help
QT += core gui opengl
CONFIG += qt
QT += gui
TARGET = BasicOpenGL
TEMPLATE = app
UPDATE: I also tried this .pro file and it didn't work
QT += core gui opengl
QT += widgets
TARGET = BasicOpenGL
TEMPLATE = app
I should say this is my first time attempting development on mac.
Compile Output from Qt
Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I. -F/Users/john/Qt/5.2.0/clang_64/lib -o mainwindow.o ../Framework/mainwindow.cpp
In file included from ../Framework/mainwindow.cpp:2:
../Framework/ui_mainwindow.h:14:10: fatal error: 'QtGui/QAction' file not found
#include <QtGui/QAction>
^
1 error generated.
make: *** [mainwindow.o] Error 1
15:51:32: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project BasicOpenGL (kit: Desktop Qt 5.2.0 clang 64bit)
When executing step 'Make'
UPDATE: I got it to work but with all the screwing around I'm not exactly sure what did it. I started with a fresh mac image, installed system updates, installed xcode, installed xcode command line tools, installed QT Creator 3.0, installed QT libraries 4.8.1, setup the compilers in QT Creator.
Try doing a make clean followed by a make. I had this exact problem on a Windows 7 system, and this is what worked for me.
In Qt5, QAction header is in QtWidgets include sub-directory, not in QtGui (that's true for Qt4). Though you don't actually need to specify include sub-directories since qmake will handle that for you. You just need to add QT += widgets to your .pro file.
Set the version to Qt5, change all #include<QtQui/*>s into #include<QtWidgets/*>.
And add QT += widgets in your .pro file.
Rebuild the project, when you get the error again, tap into the error message, and change the #include<QtQui/*>s into #include<QtWidgets/*> too.
Some answers here say that you have to change include from <QtGui/QAction> to <QtWidgets/QAction>.
It was the case when you compile under QT-5. But after QT-6 was released you have to do the opposite in QT-6 application.
Now you have to change <QtWidgets/QAction> to <QtGui/QAction>, because now QAction is located in QtGui folder in QT-6.
Although my answer is not related to your very old question, as you had QT-4 problem, still your question pops up first in Google hence I'm posting my answer for those StackOverflow visitors who have same problem but with compiling QT-5 project under QT-6, as I did.

Qt resource system bug in qt 4.8.3

I'm using Qt 4.8.3 Open Source with Qt Creator 2.6.0 on Windows 8 Pro x64. The compiler I'm using is MingW 4.4.
I've an old project that I built using Qt 4.8.0. The project has a resource file named Resource.qrc. The project compiled fine in Qt 4.8.0 and I could access everything that I mentioned in the resource file.
But in Qt 4.8.3 I can't compile the same project. Qt 4.8.3 doesn't seem to be able to compile resource file. Here is the part of the output that tried to compile Resource.qrc file:
bin\rcc.exe -name Resource ..\Source\Resource.qrc -o release\qrc_Resource.cpp
mingw32-make[1]: Leaving directory `E:/Programs/Version Control/Sources/Spadetrump/Release'
process_begin: CreateProcess(NULL, bin\rcc.exe -name Resource ..\Source\Resource.qrc -o release\qrc_Resource.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make[1]: *** [release/qrc_Resource.cpp] Error 2
mingw32-make: *** [release] Error 2
00:08:10: The process "C:\MingW\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project Spadetrump (target: Desktop)
When executing step 'Make'
It was a clean build. If I execute rcc.exe with the exact same arguments and with absolute path, qrc_Resource.cpp is generated.
I tried the above with a fresh new Qt GUI application and the result is same.
Any idea what's wrong with Qt 4.8.3?
Had the exact same issues as you with the same setup, expect for the windows version which is xp for me. The problem is that the rcc.exe cannot be found, because an incorrect path is used for that call.
There is a bugreport at qt-projects for this problem: https://bugreports.qt.io/browse/QTBUG-27237
The workarround proposed by Daniel Frömmel did the trick for me:
1) open the qmake.conf of your platform (for me its C:\Qt\4.8.3\mkspecs\win32-g++)
2) search for QMAKE_IDC
3) add the following line after the QMAKE_IDC line:
QMAKE_RCC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}rcc.exe
4) save file and clsoe
5) restart all your dev tools and remove all auto generated Makefiles
6) recompile