1.Project ERROR: Unknown module(s) in QT: webkitwidgets - c++

Well, I was trying to use QWebView. As I learned from the internet, I should, and also this line webkitwidgets in .pro file after QT +=. So I added it and get this error:
Project ERROR: Unknown module(s) in QT: webkitwidgets
I know that a lot of people already asked about this error, but most of the answers were to install libqt5webkit5-dev using this command line: sudo apt-get install libqt5webkit5-dev.
The problem is, that I am on Windows, not on Linux, so this can't be useful for me.
The weird thing is, that I have Qt5WebKitWidgets.dll and Qt5WebKit.dll in C:\Qt\Tools\QtCreator\bin, so I suppose, that I have everything I need to use QWebView and to add this line QT += webkitwidgets without getting any errors.
Also, I learned that WebKitWidgets is no longer supported after QT 5.0 and newer(or something like that), and I should use QtWebEngine, but I don't understand how to use it in Qt Widgets Application with QWebView.

You're mixing up Qt Creator (an IDE) and Qt — the development toolkit itself. It absolutely doesn't matter what's bundled with Qt Creator — whatever is there is used solely by Qt Creator since it is also built using Qt.
You need to look in your Qt's installation directory, under mkspecs/modules. Each module has a .pri file. You should see both qt_lib_webkit.pri and qt_lib_webkitwidgets.pri. If you don't, that would mean that the modules weren't built for the Qt that you're using. The modules folder is where qmake looks for Qt module definitions.
If you're using a prebuilt recent version of Qt, it's likely that it is built with WebKit turned off. The workaround would be to go to a previous minor version (say 5.4 instead of 5.5), or to build Qt yourself.

Similar to Kuba Ober's answer, I got it to work by copying the webkit and webkitwidgets pri files from a previous installation, 5.5.
~/Qt/5.5/clang_64/mkspecs/modules/

The weird thing is, that I have Qt5WebKitWidgets.dll and Qt5WebKit.dll in C:\Qt\Tools\QtCreator\bin, so I suppose, that I have everything I need to use QWebView and to add this line QT += webkitwidgets without getting any errors.
Thats because windows dlls must be on the path or on the base path of the app, is just the way of windows of doing things. You can see that if you install qtcreator on windows, the app will be without dlls on the lib folder. Everything will be on the bin folder

Related

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

Qt creator 4 cannot find QCamera

I want to use QCamera, but Qt Creator 4.0.1 with Qt 5.6.1 says that such files do not exist, when I'm trying to include it:
#include <QtMultimedia/QCamera>
I've tried it also without the QtMultimedia/ beforehand. And also autocomplition menu.
My System is Debian Testing. This is a C++11 project.
My Project.pro file looks like this:
QT += core gui opengl multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Classifier
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
[..]
I have deleted QT += multimediawidgets, because QT warns, that it is unknown.
Although libqt5multimediawidgets5 is installed. Or do I need more packages for that?
I have tried the following:
I have rerun qmake,
Closed Qt Creator, deleted Project.pro.user and reconfigured the project
Checked if all packages are installed - I hope so. qtmultimedia5-dev qt5base-dev. And libqt5multimediawidgets5 ... Would be to long, to list all, which does not mean, that I have all necessary ones.
Added the options QT_SELECT=qt5 and QTDIR=/usr/share/qt5 qmake --version to the project.pro file. Found it in some stackoverflow answer where a user guessed you could use that to enforce qt5. Because I wasn't sure, if it doesn't use Qt4. But the options do not even get highlighted. But not marked as errors either.
Tried to write 'class QCamera' to my mainwindow.h and include QCamera in the mainwindow.cpp file as seen in a Youtube tutorial
Tried the Camera Example Project, which doesn't work either
Checked, if Qt5 is available in the options menu
As mentioned, I have also Qt4 stuff installed. I have also an old project, which was set up in Windows and uses QCamera. There Qt Creator cannot find it either.
If this does not work anyway on Debian for some reason, what is an alternative -compatible with Qt?
Ubuntu 14.04 with qt5-base, qtcreator and qtmultimedia5-dev recognizes it. And there was an error in the ui mainwindow.h which occurs, if you use a qt4 project with qt5. So it used qt4 on Debian, even though qt5 is installed. But I have no idea how I can enforce qt5 in Qt Creator. So it seems to be a Qt Creator problem. This is actually no direct solution, but it works now (for me). But if anyone knows how to enforce qt5, I would appriciate it. Because Ubuntu is only a workaround

QMainWindow: No Such File Or Directory

I'm using QT Creator 3.5.1 and QT 4.8.2 on Ubuntu 14.04 LTS host machine, I configured my BeagleBone Kit for ARM crosscompiling like this:
I'm following these steps, but I'm getting an error when trying to compile the default QT project
Am I missing something? If it's not found, it is not located at place where compiler looks. How do you fix this?
Here is my project file
Using Qt 5.8.0 on Win 7 / MSVC2015x64bit;
I had the same issue and I found a way to fix it, even if its not the smartest:
1) Open your projectname.pro file
2) Between
QT += core gui
and
greaterThan(QT_MAJOR_VERSION, X): QT += widgets
paste QT += widgets
so this part looks kinda like this:
...
QT += core gui
QT += widgets
greaterThan(QT_MAJOR...
Save and close the .pro file and wait for Qt to automatic read the
file-changes and updating itself.
(If you have deaktivated this try restart Qt)
Aswell as this - replacing the "X" at greaterThan(QT_MAJOR_VERSION, X): QT += widgets with the pre-version's number works fine for me. (X = your_major_version - 1)
(In case using Qt 5.x place a 4 instead of 5, using Qt 3.x replace 3 with 2 and so on...)
I dont know if this also works for other platforms...
I hope i could help at least 1 person who has the same issue. ;)
Greetings Zitro
Mybe there was some error while your building qt from source, or something is missing. Try search QMainWindow.h in qt include dir. Seems like it is in /usr/local/qt4.8.2-armhf/include. For am example you can search like this find * /usr/local/qt4.8.2-armhf/include/ | grep QMainWindow.
First of all you need make sure, that cross compiler works,
compile hello world: std::cout << "hi\n" and run on device using cross comipler gcc from command line.
Second step is making sure that qmake from cross compiled Qt works as expected, run /usr/local/qt4.8.2-armhf/bin/qmake path/to/your/pro/file && make if all works then next step
Third, at last configure your Qt Creator
Look here: http://developer.toradex.com/how-to/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux
You need set sysroot to right value, for example in my case this is:
/usr/local/oecore-i686/sysroots/armv7ahf-vfp-neon-angstrom-linux-gnueabi/
inside this directory there "bin" and "lib" full of arm executables and arm libraries, this is what "sysroot", it is part of your device file system cloned to your cross compiler, that help you link your applications. Also make sure that you set right path to qmake for cross compilation in Qt creator preferences, it should like this: /usr/local/qt4.8.2-armhf/bin/qmake
Perhaps your QT Creator version is out of date. Projects can become corrupted if you install a version of QT Creator that is incompatible with them. You can download the latest version of QT Creator in the Software Center.
You also need to make sure your QT is up to date. Check using the Software Updater.
I found this; you might want to take a look at it: derekmolloy.ie/beaglebone/qt-with-embedded-linux-on-the-beaglebone/#Source_Code
On windows check that your project folder doesn't have strange characters like: ( , ) or # ...

Qt Libraries are not included

I checked if the question exists but it doesn't seem to help me. I'm clearly new to Qt, i installed Qt Creator 5.4 in my Windows 7 Ultimate. I installed everything Qt 5.4 provides and also installed MinGW 4.9.1. The problem is when i open a console application project it immediately gives these errors. I tried different projects and error is the same.
Project ERROR: Unknown module(s) in QT: core
I tried to check intellisense for include and it didn't show ANY library to me.
When i hover to include it gives : QCoreApplication: No such file or directory
I highly doubt Qt can't find it's own libraries. How can i show it to QtCreator ?
Additional info : Run button and everything related to run is disabled.
Any help will be appreciated, thanks :)
Maybe your project's path contains non ASCII characters.
Try a new project somewhere like C:\MyApp

Header location issues while porting Qt code from Windows to Ubuntu

I'm trying to port code written in Qt on Windows to Qt on Ubuntu. The problem I'm facing is that it gives me this error for my ui_windowform.h header:
error: QtWidgets/QApplication: No such file or directory
I searched on Google for solutions but didn't find anything relevant. I've also added INCLUDEPATH += $QTDIR/include/qt4/QtGuito .pro file.
I mostly of agree with LukasT, but Qt 4 does still have QApplication, however it is located in a slightly different location :) .... or maybe :(
You should find it here: .../qt4/QtGui/QApplication .... or somthing like that, I can't quite recall now...
But I would definatley try to keep your Qt version the same on each platform then you garantee that you will have no Qt lib issues... compiler on the other hand is not garanteed :o (but I would not worry too much about that)
It looks like the original Qt code uses Qt5, QtWidgets/QApplication rings the bell from me [1] and you are pointing to Qt4 in Ubuntu. You should try to install Qt5 in Ubuntu.
[1] http://qt-project.org/doc/qt-5.0/qtwidgets/qtwidgets-index.html